mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
fix: 企业微信通知改成text类型,因为markdown类型不支持@用户
This commit is contained in:
@@ -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,
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user