()
| 488 | } |
| 489 | |
| 490 | function readShareCode() { |
| 491 | return new Promise(async resolve => { |
| 492 | $.get({url: `http://sharecodepool.cnmb.pw/api/pet/${randomCount}`, 'timeout': 10000}, (err, resp, data) => { |
| 493 | try { |
| 494 | if (err) { |
| 495 | console.log(`${JSON.stringify(err)}`) |
| 496 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 497 | } else { |
| 498 | if (data) { |
| 499 | console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`) |
| 500 | data = JSON.parse(data); |
| 501 | } |
| 502 | } |
| 503 | } catch (e) { |
| 504 | $.logErr(e, resp) |
| 505 | } finally { |
| 506 | resolve(data); |
| 507 | } |
| 508 | }) |
| 509 | await $.wait(10000); |
| 510 | resolve() |
| 511 | }) |
| 512 | } |
| 513 | |
| 514 | function shareCodesFormat() { |
| 515 | return new Promise(async resolve => { |
no test coverage detected