diff --git a/env.example.js b/env.example.js index b3c06ec..967ca7a 100644 --- a/env.example.js +++ b/env.example.js @@ -12,12 +12,12 @@ module.exports = Object.freeze({ * ## 调试相关 * - `LOTTERY_LOG_LEVEL` 输出日志等级 Error { + if (GOTIFY_APPKEY) { + send({ + method: 'POST', + url: GOTIFY_URL, + contents: { + title: test, + message: desp, + }, + config: { + retry: false + }, + headers: { + accept: 'application/json, text/plain, */*', + 'content-type': 'application/json', + 'authorization': 'Bearer ' + GOTIFY_APPKEY + }, + success: () => { + // HTTP 响应码 200 就说明成功了 + log.info('发送通知', 'Gotify 发送通知消息成功') + resolve(); + }, + failure: err => { + log.error('发送通知', 'Gotify 发送通知调用API失败!!' + err) + resolve(); + } + }) + } else { + log.debug('发送通知', '您未提供Gotify推送所需的GOTIFY_APPKEY,取消Gotify推送消息通知'); + resolve() + } + }) +} + async function qmsg(text, desp) { return new Promise(resolve => { if (QMSG_KEY) { @@ -889,4 +940,4 @@ async function email(text, desp) { } } -module.exports = { sendNotify } \ No newline at end of file +module.exports = { sendNotify }