-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3545b9f
commit 4dc8232
Showing
4 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
export * from './push/dingtalk' | ||
export * from './push/cool-push' | ||
export * from './push/dingtalk' | ||
export * from './push/email' | ||
export * from './push/i-got' | ||
export * from './push/push-plus' | ||
export * from './push/qmsg' | ||
export * from './push/server-chan-turbo' | ||
export * from './push/wechat-app' | ||
export * from './push/wechat-robot' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { AxiosResponse } from 'axios' | ||
import debug from 'debug' | ||
import { Send } from '../interfaces/send' | ||
import { ajax } from '@/utils/ajax' | ||
|
||
const Debugger = debug('push:qmsg') | ||
|
||
/** | ||
* 推送类型,见 [Qmsg](https://qmsg.zendee.cn/api.html)。 | ||
*/ | ||
export type QmsgPushType = 'send' | 'group' | ||
|
||
/** | ||
* Qmsg酱。使用说明见 [Qmsg酱](https://qmsg.zendee.cn/api.html) | ||
* | ||
* @author CaoMeiYouRen | ||
* @date 2022-02-17 | ||
* @export | ||
* @class Qmsg | ||
*/ | ||
export class Qmsg implements Send { | ||
|
||
private QMSG_KEY: string | ||
|
||
constructor(QMSG_KEY: string) { | ||
this.QMSG_KEY = QMSG_KEY | ||
Debugger('set QMSG_KEY: "%s"', QMSG_KEY) | ||
if (!this.QMSG_KEY) { | ||
throw new Error('QMSG_KEY 是必须的!') | ||
} | ||
} | ||
|
||
async send(msg: string, qq?: string, type: QmsgPushType = 'send'): Promise<any> { | ||
return ajax({ | ||
url: `https://qmsg.zendee.cn/${type}/${this.QMSG_KEY}`, | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
}, | ||
method: 'POST', | ||
data: { msg, qq }, | ||
}) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters