()
| 336 | } |
| 337 | |
| 338 | function readShareCode() { |
| 339 | console.log(`开始`) |
| 340 | return new Promise(async resolve => { |
| 341 | $.get({ |
| 342 | url: `http://jd.turinglabs.net/api/v2/jd/immortal/read/${randomCount}/`, |
| 343 | 'timeout': 10000 |
| 344 | }, (err, resp, data) => { |
| 345 | try { |
| 346 | if (err) { |
| 347 | console.log(`${JSON.stringify(err)}`) |
| 348 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 349 | } else { |
| 350 | if (data) { |
| 351 | console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) |
| 352 | data = JSON.parse(data); |
| 353 | } |
| 354 | } |
| 355 | } catch (e) { |
| 356 | $.logErr(e, resp) |
| 357 | } finally { |
| 358 | resolve(data); |
| 359 | } |
| 360 | }) |
| 361 | await $.wait(2000); |
| 362 | resolve() |
| 363 | }) |
| 364 | } |
| 365 | |
| 366 | //格式化助力码 |
| 367 | function shareCodesFormat() { |
no test coverage detected