From 747d26674248082e678a3fd5ecc94712641a2716 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 15 Jul 2025 17:15:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=94=B9=E6=88=90text=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=9B=A0=E4=B8=BAmarkdown=E7=B1=BB=E5=9E=8B=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81@=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/plugin-notification/qywx/index.ts | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/packages/ui/certd-server/src/plugins/plugin-notification/qywx/index.ts b/packages/ui/certd-server/src/plugins/plugin-notification/qywx/index.ts index 2d7d45dc..02526421 100644 --- a/packages/ui/certd-server/src/plugins/plugin-notification/qywx/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-notification/qywx/index.ts @@ -47,26 +47,35 @@ export class QywxNotification extends BaseNotification { if (!this.webhook) { throw new Error('webhook地址不能为空'); } - /** - * - * "msgtype": "text", - * "text": { - * "content": "hello world" - * } - * } - */ - const color = body.errorMessage?'red':'green'; + await this.http.request({ url: this.webhook, method: 'POST', data: { - msgtype: 'markdown', - markdown: { - content: `${body.title}\n\n\n${body.content}\n\n[查看详情](${body.url})`, + msgtype: 'text', + text: { + content: `${body.title}\n${body.content}\n查看详情: ${body.url}`, mentioned_list: this.mentionedList, mentioned_mobile_list: this.mentionedMobileList, }, }, }); + + + //Markdown 模式不支持@ + + // const color = body.errorMessage?'red':'green'; + // await this.http.request({ + // url: this.webhook, + // method: 'POST', + // data: { + // msgtype: 'markdown', + // markdown: { + // content: `${body.title}\n\n\n${body.content}\n\n[查看详情](${body.url})`, + // mentioned_list: this.mentionedList, + // mentioned_mobile_list: this.mentionedMobileList, + // }, + // }, + // }); } }