变量重命名

This commit is contained in:
NekoMio 2022-03-02 08:44:50 +08:00
parent 53bdc7fd5d
commit 58ffcde9f9
No known key found for this signature in database
GPG Key ID: 4151059D56C21E8E
2 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@ export enum NotificationMode {
'gotify' = 'gotify', 'gotify' = 'gotify',
'goCqHttpBot' = 'goCqHttpBot', 'goCqHttpBot' = 'goCqHttpBot',
'serverChan' = 'serverChan', 'serverChan' = 'serverChan',
'PushDeer' = 'PushDeer', 'pushDeer' = 'pushDeer',
'bark' = 'bark', 'bark' = 'bark',
'telegramBot' = 'telegramBot', 'telegramBot' = 'telegramBot',
'dingtalkBot' = 'dingtalkBot', 'dingtalkBot' = 'dingtalkBot',
@ -34,7 +34,7 @@ export class ServerChanNotification extends NotificationBaseInfo {
} }
export class PushDeerNotification extends NotificationBaseInfo { export class PushDeerNotification extends NotificationBaseInfo {
public PushDeerKey = ''; public pushDeerKey = '';
} }
export class BarkNotification extends NotificationBaseInfo { export class BarkNotification extends NotificationBaseInfo {

View File

@ -16,7 +16,7 @@ export default class NotificationService {
['gotify', this.gotify], ['gotify', this.gotify],
['goCqHttpBot', this.goCqHttpBot], ['goCqHttpBot', this.goCqHttpBot],
['serverChan', this.serverChan], ['serverChan', this.serverChan],
['PushDeer', this.PushDeer], ['pushDeer', this.pushDeer],
['bark', this.bark], ['bark', this.bark],
['telegramBot', this.telegramBot], ['telegramBot', this.telegramBot],
['dingtalkBot', this.dingtalkBot], ['dingtalkBot', this.dingtalkBot],
@ -117,15 +117,17 @@ export default class NotificationService {
return res.errno === 0 || res.data.errno === 0; return res.errno === 0 || res.data.errno === 0;
} }
private async PushDeer() { private async pushDeer() {
const { PushDeerKey } = this.params; const { pushDeerKey } = this.params;
// https://api2.pushdeer.com/message/push?pushkey=<key>&text=标题&desp=<markdown>&type=markdown // https://api2.pushdeer.com/message/push?pushkey=<key>&text=标题&desp=<markdown>&type=markdown
const url = `https://api2.pushdeer.com/message/push`; const url = `https://api2.pushdeer.com/message/push`;
const res: any = await got const res: any = await got
.post(url, { .post(url, {
timeout: this.timeout, timeout: this.timeout,
retry: 0, retry: 0,
body: `pushkey=${PushDeerKey}&text=${this.title}&desp=${this.content}&type=markdown`, body: `pushkey=${pushDeerKey}&text=${
this.title
}&desp=${encodeURIComponent(this.content)}&type=markdown`,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
}) })
.json(); .json();