fix: 企业微信通知改成text类型,因为markdown类型不支持@用户

v2^2
xiaojunnuo 2025-07-15 17:15:43 +08:00
parent 6135a44a8d
commit 747d266742
1 changed files with 21 additions and 12 deletions

View File

@ -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: `<font color='${color}'>${body.title}</font>\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: `<font color='${color}'>${body.title}</font>\n\n\n${body.content}\n\n[查看详情](${body.url})`,
// mentioned_list: this.mentionedList,
// mentioned_mobile_list: this.mentionedMobileList,
// },
// },
// });
}
}