()
| 308 | } |
| 309 | |
| 310 | function readShareCode() { |
| 311 | console.log(`开始`) |
| 312 | return new Promise(async resolve => { |
| 313 | $.get({ |
| 314 | url: `http://jd.turinglabs.net/api/v2/jd/jdglobal/read/${randomCount}/`, |
| 315 | 'timeout': 10000 |
| 316 | }, (err, resp, data) => { |
| 317 | try { |
| 318 | if (err) { |
| 319 | console.log(`${JSON.stringify(err)}`) |
| 320 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 321 | } else { |
| 322 | if (data) { |
| 323 | console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) |
| 324 | data = JSON.parse(data); |
| 325 | } |
| 326 | } |
| 327 | } catch (e) { |
| 328 | $.logErr(e, resp) |
| 329 | } finally { |
| 330 | resolve(data); |
| 331 | } |
| 332 | }) |
| 333 | await $.wait(10000); |
| 334 | resolve() |
| 335 | }) |
| 336 | } |
| 337 | |
| 338 | //格式化助力码 |
| 339 | function shareCodesFormat() { |
no test coverage detected