| 297 | } |
| 298 | //邀请助力 |
| 299 | async function invite(invite_pins) { |
| 300 | console.log(`账号${$.index} [${UserName}] 给下面名单的人进行邀请助力\n${invite_pins.map(item => item.trim())}\n`); |
| 301 | for (let item of invite_pins.map(item => item.trim())) { |
| 302 | console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行邀请助力`) |
| 303 | if (UserName === item) { |
| 304 | console.log(`自己账号,跳过`); |
| 305 | continue |
| 306 | } |
| 307 | const data = await enterRoom(item); |
| 308 | if (data) { |
| 309 | if (data.success) { |
| 310 | const { helpStatus } = data.data; |
| 311 | console.log(`helpStatus ${helpStatus}`) |
| 312 | if (helpStatus=== 'help_full') { |
| 313 | console.log(`您的邀请助力机会已耗尽\n`) |
| 314 | break; |
| 315 | } else if (helpStatus=== 'cannot_help') { |
| 316 | console.log(`已给该好友 ${item} 助力过或者此friendPin是你自己\n`) |
| 317 | } else if (helpStatus=== 'invite_full') { |
| 318 | console.log(`助力失败,该好友 ${item} 已经满3人给他助力了,无需您再次助力\n`) |
| 319 | } else if (helpStatus=== 'can_help') { |
| 320 | console.log(`开始给好友 ${item} 助力\n`) |
| 321 | const LKYL_DATA = await helpInviteFriend(item); |
| 322 | if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) { |
| 323 | console.log('来客有礼宠汪汪token失效'); |
| 324 | $.setdata('', 'jdJoyRunToken'); |
| 325 | $.msg($.name, '【提示】来客有礼token失效,请重新获取', "iOS用户微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token") |
| 326 | $.LKYLLogin = false; |
| 327 | break |
| 328 | } else { |
| 329 | $.LKYLLogin = true; |
| 330 | } |
| 331 | } |
| 332 | $.jdLogin = true; |
| 333 | } else { |
| 334 | if (data.errorCode === 'B0001') { |
| 335 | console.log('京东Cookie失效'); |
| 336 | $.msg($.name, `【提示】京东cookie已失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); |
| 337 | $.jdLogin = false; |
| 338 | break |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | // if ($.inviteReward > 0) { |
| 344 | // $.msg($.name, ``, `账号${$.index} [${UserName}]\n给${$.inviteReward/5}人邀请助力成功\n获得${$.inviteReward}积分`) |
| 345 | // } |
| 346 | } |
| 347 | function enterRoom(invitePin) { |
| 348 | return new Promise(resolve => { |
| 349 | headers.Cookie = cookie; |