format: format code

pull/5464/head
xx 1 week ago
parent 7add28ebd9
commit b0910138f3

@ -14,10 +14,7 @@ class DingDing extends NotificationProvider {
const mentionAll = notification.mentioning === "everyone" const mentionAll = notification.mentioning === "everyone"
const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : [] const mobileList = notification.mentioning === "specify-mobiles" ? notification.mobileList.split(",") : []
const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : [] const userList = notification.mentioning === "specify-users" ? notification.userList.split(",") : []
const mentionStr = [...mobileList || [], ...userList || [] ].map(item => `@${item}`).join(" ") const mentionStr = [...mobileList || [], ...userList || []].map(item => `@${item}`).join(" ")
console.log('mobileList: ',mobileList)
console.log('userList: ',userList)
console.log('mentionStr: ',mentionStr)
try { try {
if (heartbeatJSON != null) { if (heartbeatJSON != null) {
notification.mobileList notification.mobileList
@ -25,7 +22,7 @@ class DingDing extends NotificationProvider {
msgtype: "markdown", msgtype: "markdown",
markdown: { markdown: {
title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`, title: `[${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]}`,
text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${'\n\n'+mentionStr}`, text: `## [${this.statusToString(heartbeatJSON["status"])}] ${monitorJSON["name"]} \n> ${heartbeatJSON["msg"]}\n> Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}${'\n\n' + mentionStr}`,
}, },
at: { at: {
isAtAll: mentionAll, isAtAll: mentionAll,
@ -40,7 +37,7 @@ class DingDing extends NotificationProvider {
let params = { let params = {
msgtype: "text", msgtype: "text",
text: { text: {
content: `${msg}${'\n'+mentionStr}` content: `${msg}${'\n' + mentionStr}`
}, },
at: { at: {
isAtAll: mentionAll, isAtAll: mentionAll,

Loading…
Cancel
Save