diff --git a/back/data/notify.ts b/back/data/notify.ts index ec996b86..144cd758 100644 --- a/back/data/notify.ts +++ b/back/data/notify.ts @@ -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 { diff --git a/back/services/notify.ts b/back/services/notify.ts index a8884f7b..5dd053f6 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -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=&text=标题&desp=&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();