(run_pins)
| 420 | } |
| 421 | //赛跑助力 |
| 422 | async function run(run_pins) { |
| 423 | console.log(`账号${$.index} [${UserName}] 给下面名单的人进行赛跑助力\n${(run_pins.map(item => item.trim()))}\n`); |
| 424 | for (let item of run_pins.map(item => item.trim())) { |
| 425 | console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行赛跑助力`) |
| 426 | if (UserName === item) { |
| 427 | console.log(`自己账号,跳过`); |
| 428 | continue |
| 429 | } |
| 430 | const combatDetailRes = await combatDetail(item); |
| 431 | const { petRaceResult } = combatDetailRes.data; |
| 432 | console.log(`petRaceResult ${petRaceResult}`); |
| 433 | if (petRaceResult === 'help_full') { |
| 434 | console.log('您的赛跑助力机会已耗尽'); |
| 435 | break; |
| 436 | } else if (petRaceResult === 'can_help') { |
| 437 | console.log(`开始赛跑助力好友 ${item}`) |
| 438 | const LKYL_DATA = await combatHelp(item); |
| 439 | if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) { |
| 440 | console.log('来客有礼宠汪汪token失效'); |
| 441 | $.setdata('', 'jdJoyRunToken'); |
| 442 | $.msg($.name, '【提示】来客有礼token失效,请重新获取', "iOS用户微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token") |
| 443 | $.LKYLLogin = false; |
| 444 | break |
| 445 | } else { |
| 446 | $.LKYLLogin = true; |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | // if ($.runReward > 0) { |
| 451 | // $.msg($.name, ``, `账号${$.index} [${UserName}]\n给${$.runReward/5}人赛跑助力成功\n获得狗粮${$.runReward}g`) |
| 452 | // } |
| 453 | } |
| 454 | function combatHelp(friendPin) { |
| 455 | return new Promise(resolve => { |
| 456 | headers.Cookie = cookie; |
no test coverage detected