Skip to content

Commit

Permalink
feat: 更新 pushplus 接口
Browse files Browse the repository at this point in the history
  • Loading branch information
CaoMeiYouRen committed Jun 6, 2021
1 parent 3c17bce commit 4a1de7a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
13 changes: 11 additions & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', [
'feat', 'fix', 'docs', 'style', 'refactor', 'test',
'chore', 'revert', 'upgrade', 'build', 'perf',
'feat',
'fix',
'docs',
'style',
'refactor',
'test',
'chore',
'revert',
'upgrade',
'build',
'perf',
]],
'subject-full-stop': [0, 'never'],
'subject-case': [0, 'never'],
Expand Down
17 changes: 11 additions & 6 deletions src/push/push-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { Send } from '../interfaces/send'

const Debugger = debug('push:push-plus')

export type TemplateType = 'html' | 'json' | 'cloudMonitor' | 'jenkins' | 'route'
export type TemplateType = 'html' | 'txt' | 'json' | 'markdown' | 'cloudMonitor' | 'jenkins' | 'route'

export type ChannelType = 'wechat' | 'webhook' | 'cp' | 'sms' | 'mail'

/**
* pushplus 推送加开放平台,仅支持一对一推送。官方文档:https://www.pushplus.plus/doc/
*
Expand Down Expand Up @@ -39,13 +42,14 @@ export class PushPlus implements Send {
*
*
* @author CaoMeiYouRen
* @date 2021-03-03
* @param title 消息标题
* @param [content] 具体消息内容,根据不同template支持不同格式
* @param [template='html'] 发送消息模板,默认为 html
* @date 2021-06-06
* @param title
* @param [content] 消息标题
* @param [template='html'] 具体消息内容,根据不同template支持不同格式
* @param [channel='wechat'] 发送渠道
* @returns
*/
send(title: string, content?: string, template: TemplateType = 'html'): Promise<AxiosResponse<any>> {
send(title: string, content?: string, template: TemplateType = 'html', channel: ChannelType = 'wechat'): Promise<AxiosResponse<any>> {
Debugger('title: "%s", content: "%s", template: "%s"', title, content, template)
return ajax({
url: 'http://www.pushplus.plus/send',
Expand All @@ -58,6 +62,7 @@ export class PushPlus implements Send {
title,
content: content || title,
template,
channel,
},
})
}
Expand Down

0 comments on commit 4a1de7a

Please sign in to comment.