mirror of https://github.com/certd/certd
fix: 企业微信通知改成text类型,因为markdown类型不支持@用户
parent
6135a44a8d
commit
747d266742
|
@ -47,26 +47,35 @@ export class QywxNotification extends BaseNotification {
|
||||||
if (!this.webhook) {
|
if (!this.webhook) {
|
||||||
throw new Error('webhook地址不能为空');
|
throw new Error('webhook地址不能为空');
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
*
|
|
||||||
* "msgtype": "text",
|
|
||||||
* "text": {
|
|
||||||
* "content": "hello world"
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
const color = body.errorMessage?'red':'green';
|
|
||||||
await this.http.request({
|
await this.http.request({
|
||||||
url: this.webhook,
|
url: this.webhook,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
msgtype: 'markdown',
|
msgtype: 'text',
|
||||||
markdown: {
|
text: {
|
||||||
content: `<font color='${color}'>${body.title}</font>\n\n\n${body.content}\n\n[查看详情](${body.url})`,
|
content: `${body.title}\n${body.content}\n查看详情: ${body.url}`,
|
||||||
mentioned_list: this.mentionedList,
|
mentioned_list: this.mentionedList,
|
||||||
mentioned_mobile_list: this.mentionedMobileList,
|
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,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue