()
| 549 | }) |
| 550 | } |
| 551 | function readShareCode() { |
| 552 | console.log(`开始`) |
| 553 | return new Promise(async resolve => { |
| 554 | $.get({ |
| 555 | url: `http://jd.turinglabs.net/api/v2/jd/5g/read/${randomCount}/`, |
| 556 | 'timeout': 10000 |
| 557 | }, (err, resp, data) => { |
| 558 | try { |
| 559 | if (err) { |
| 560 | console.log(`${JSON.stringify(err)}`) |
| 561 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 562 | } else { |
| 563 | if (data) { |
| 564 | console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) |
| 565 | data = JSON.parse(data); |
| 566 | } |
| 567 | } |
| 568 | } catch (e) { |
| 569 | $.logErr(e, resp) |
| 570 | } finally { |
| 571 | resolve(data); |
| 572 | } |
| 573 | }) |
| 574 | await $.wait(2000); |
| 575 | resolve() |
| 576 | }) |
| 577 | } |
| 578 | |
| 579 | //格式化助力码 |
| 580 | function shareCodesFormat() { |
no test coverage detected