变量重命名

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',
'goCqHttpBot' = 'goCqHttpBot',
'serverChan' = 'serverChan',
'PushDeer' = 'PushDeer',
'pushDeer' = 'pushDeer',
'bark' = 'bark',
'telegramBot' = 'telegramBot',
'dingtalkBot' = 'dingtalkBot',
@ -34,7 +34,7 @@ export class ServerChanNotification extends NotificationBaseInfo {
}
export class PushDeerNotification extends NotificationBaseInfo {
public PushDeerKey = '';
public pushDeerKey = '';
}
export class BarkNotification extends NotificationBaseInfo {

View File

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