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