From 58ffcde9f993a274ef00d6b6287bad31958ca23e Mon Sep 17 00:00:00 2001 From: NekoMio Date: Wed, 2 Mar 2022 08:44:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/data/notify.ts | 4 ++-- back/services/notify.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) 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();