()
| 626 | }) |
| 627 | } |
| 628 | function readShareCode() { |
| 629 | console.log(`开始`) |
| 630 | return new Promise(async resolve => { |
| 631 | $.get({url: `http://www.helpu.cf/jdcodes/getcode.php?type=ddfactory&num=${randomCount}`, timeout: 10000}, (err, resp, data) => { |
| 632 | try { |
| 633 | if (err) { |
| 634 | console.log(`${JSON.stringify(err)}`) |
| 635 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 636 | } else { |
| 637 | if (data) { |
| 638 | console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) |
| 639 | data = JSON.parse(data); |
| 640 | } |
| 641 | } |
| 642 | } catch (e) { |
| 643 | $.logErr(e, resp) |
| 644 | } finally { |
| 645 | resolve(data); |
| 646 | } |
| 647 | }) |
| 648 | await $.wait(10000); |
| 649 | resolve() |
| 650 | }) |
| 651 | } |
| 652 | //提交互助码 |
| 653 | function submitCode() { |
| 654 | return new Promise(async resolve => { |
no test coverage detected