()
| 318 | } |
| 319 | |
| 320 | function readShareCode() { |
| 321 | console.log(`开始`) |
| 322 | return new Promise(async resolve => { |
| 323 | $.get({ |
| 324 | url: `http://www.helpu.cf/jdcodes/getcode.php?type=sgmh&num=${randomCount}`, |
| 325 | 'timeout': 10000 |
| 326 | }, (err, resp, data) => { |
| 327 | try { |
| 328 | if (err) { |
| 329 | console.log(`${JSON.stringify(err)}`) |
| 330 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 331 | } else { |
| 332 | if (data) { |
| 333 | console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`) |
| 334 | data = JSON.parse(data); |
| 335 | } |
| 336 | } |
| 337 | } catch (e) { |
| 338 | $.logErr(e, resp) |
| 339 | } finally { |
| 340 | resolve(data); |
| 341 | } |
| 342 | }) |
| 343 | await $.wait(2000); |
| 344 | resolve() |
| 345 | }) |
| 346 | } |
| 347 | //提交互助码 |
| 348 | function submitCode() { |
| 349 | return new Promise(async resolve => { |
no test coverage detected