(text, desp)
| 654 | } |
| 655 | |
| 656 | function do_qywxamNotify(text, desp) { |
| 657 | return new Promise((resolve) => { |
| 658 | const { QYWX_AM, QYWX_ORIGIN } = push_config; |
| 659 | if (QYWX_AM) { |
| 660 | const QYWX_AM_AY = QYWX_AM.split(','); |
| 661 | const options_accesstoken = { |
| 662 | url: `${QYWX_ORIGIN}/cgi-bin/gettoken`, |
| 663 | json: { |
| 664 | corpid: `${QYWX_AM_AY[0]}`, |
| 665 | corpsecret: `${QYWX_AM_AY[1]}`, |
| 666 | }, |
| 667 | headers: { |
| 668 | 'Content-Type': 'application/json', |
| 669 | }, |
| 670 | timeout, |
| 671 | }; |
| 672 | $.post(options_accesstoken, (err, resp, json) => { |
| 673 | let html = desp.replace(/\n/g, '<br/>'); |
| 674 | let accesstoken = json.access_token; |
| 675 | let options; |
| 676 | |
| 677 | switch (QYWX_AM_AY[4]) { |
| 678 | case '0': |
| 679 | options = { |
| 680 | msgtype: 'textcard', |
| 681 | textcard: { |
| 682 | title: `${text}`, |
| 683 | description: `${desp}`, |
| 684 | url: 'https://github.com/whyour/qinglong', |
| 685 | btntxt: '更多', |
| 686 | }, |
| 687 | }; |
| 688 | break; |
| 689 | |
| 690 | case '1': |
| 691 | options = { |
| 692 | msgtype: 'text', |
| 693 | text: { |
| 694 | content: `${text}\n\n${desp}`, |
| 695 | }, |
| 696 | }; |
| 697 | break; |
| 698 | |
| 699 | default: |
| 700 | options = { |
| 701 | msgtype: 'mpnews', |
| 702 | mpnews: { |
| 703 | articles: [ |
| 704 | { |
| 705 | title: `${text}`, |
| 706 | thumb_media_id: `${QYWX_AM_AY[4]}`, |
| 707 | author: `智能助手`, |
| 708 | content_source_url: ``, |
| 709 | content: `${html}`, |
| 710 | digest: `${desp}`, |
| 711 | }, |
| 712 | ], |
| 713 | }, |
no test coverage detected