(text, desp)
| 476 | } |
| 477 | |
| 478 | function qywxamNotify(text, desp) { |
| 479 | return new Promise(resolve => { |
| 480 | if (QYWX_AM) { |
| 481 | const QYWX_AM_AY = QYWX_AM.split(','); |
| 482 | const options_accesstoken = { |
| 483 | url: `https://qyapi.weixin.qq.com/cgi-bin/gettoken`, |
| 484 | json: { |
| 485 | corpid: `${QYWX_AM_AY[0]}`, |
| 486 | corpsecret: `${QYWX_AM_AY[1]}`, |
| 487 | }, |
| 488 | headers: { |
| 489 | 'Content-Type': 'application/json', |
| 490 | }, |
| 491 | timeout |
| 492 | }; |
| 493 | $.post(options_accesstoken, (err, resp, data) => { |
| 494 | html = desp.replace(/\n/g, "<br/>") |
| 495 | var json = JSON.parse(data); |
| 496 | accesstoken = json.access_token; |
| 497 | let options; |
| 498 | |
| 499 | switch (QYWX_AM_AY[4]) { |
| 500 | case '0': |
| 501 | options = { |
| 502 | msgtype: 'textcard', |
| 503 | textcard: { |
| 504 | title: `${text}`, |
| 505 | description: `${desp}`, |
| 506 | url: '', |
| 507 | btntxt: '更多' |
| 508 | } |
| 509 | } |
| 510 | break; |
| 511 | |
| 512 | case '1': |
| 513 | options = { |
| 514 | msgtype: 'text', |
| 515 | text: { |
| 516 | content: `${text}\n\n${desp}` |
| 517 | } |
| 518 | } |
| 519 | break; |
| 520 | |
| 521 | default: |
| 522 | options = { |
| 523 | msgtype: 'mpnews', |
| 524 | mpnews: { |
| 525 | articles: [ |
| 526 | { |
| 527 | title: `${text}`, |
| 528 | thumb_media_id: `${QYWX_AM_AY[4]}`, |
| 529 | author: `智能助手`, |
| 530 | content_source_url: ``, |
| 531 | content: `${html}`, |
| 532 | digest: `${desp}` |
| 533 | } |
| 534 | ] |
| 535 | } |
no test coverage detected