(text, desp)
| 1438 | } |
| 1439 | |
| 1440 | function qywxBotNotify(text, desp) { |
| 1441 | return new Promise((resolve) => { |
| 1442 | const options = { |
| 1443 | url: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${QYWX_KEY}`, |
| 1444 | json: { |
| 1445 | msgtype: 'text', |
| 1446 | text: { |
| 1447 | content: ` ${text}\n\n${desp}`, |
| 1448 | }, |
| 1449 | }, |
| 1450 | headers: { |
| 1451 | 'Content-Type': 'application/json', |
| 1452 | }, |
| 1453 | timeout, |
| 1454 | }; |
| 1455 | if (QYWX_KEY) { |
| 1456 | $.post(options, (err, resp, data) => { |
| 1457 | try { |
| 1458 | if (err) { |
| 1459 | console.log('企业微信发送通知消息失败!!\n'); |
| 1460 | console.log(err); |
| 1461 | } else { |
| 1462 | data = JSON.parse(data); |
| 1463 | if (data.errcode === 0) { |
| 1464 | console.log('企业微信发送通知消息成功🎉。\n'); |
| 1465 | } else { |
| 1466 | console.log(`${data.errmsg}\n`); |
| 1467 | } |
| 1468 | } |
| 1469 | } catch (e) { |
| 1470 | $.logErr(e, resp); |
| 1471 | } |
| 1472 | finally { |
| 1473 | resolve(data); |
| 1474 | } |
| 1475 | }); |
| 1476 | } else { |
| 1477 | resolve(); |
| 1478 | } |
| 1479 | }); |
| 1480 | } |
| 1481 | |
| 1482 | function fsBotNotify(text, desp) { |
| 1483 | return new Promise((resolve) => { |
no test coverage detected