fix jd_joy_run.js

This commit is contained in:
lxk0301
2021-01-06 16:02:25 +08:00
parent ebb8c652f6
commit 794ef13084
2 changed files with 36 additions and 33 deletions

View File

@ -66,7 +66,8 @@
**脚本兼容: [QuantumultX](https://apps.apple.com/us/app/quantumult-x/id1443988620), [Surge](https://apps.apple.com/us/app/surge-4/id1442620678), [Loon](https://apps.apple.com/us/app/loon/id1373567447), 小火箭, JSBox, Node.js**
**TODO**
- [ ] 所有活动互助码在一个脚本打印
- [x] 所有活动互助码在一个脚本打印
- [ ] 京喜工厂添加预测N天后可兑换功能
## 邀请码互助
- [邀请码互助入口](https://github.com/lxk0301/jd_scripts/discussions)

View File

@ -1,6 +1,6 @@
/**
宠汪汪邀请助力与赛跑助力脚本感谢github@Zero-S1提供帮助
更新时间2020-12-16宠汪汪助力更新Token的配置正则表达式已改
更新时间2021-1-6宠汪汪助力更新Token的配置正则表达式已改
token时效很短几个小时就失效了,闲麻烦的放弃就行
每天拿到token后可一次性运行完毕即可。
@ -245,37 +245,39 @@ async function invite(invite_pins) {
for (let item of invite_pins.map(item => item.trim())) {
console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行邀请助力`)
const data = await enterRoom(item);
if (!data.success && data.errorCode === 'B0001') {
console.log('京东Cookie失效');
$.msg($.name, `【提示】京东cookie失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
$.jdLogin = false;
break
} else {
const { helpStatus } = data.data;
console.log(`helpStatus ${helpStatus}`)
if (helpStatus=== 'help_full') {
console.log(`您的邀请助力机会已耗尽\n`)
break;
} else if (helpStatus=== 'cannot_help') {
console.log(`已给该好友 ${item} 助力过或者此friendPin是你自己\n`)
continue;
} else if (helpStatus=== 'invite_full') {
console.log(`助力失败,该好友 ${item} 已经满3人给他助力了,无需您再次助力\n`)
continue;
} else if (helpStatus=== 'can_help') {
console.log(`开始给好友 ${item} 助力\n`)
const LKYL_DATA = await helpInviteFriend(item);
if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) {
console.log('来客有礼宠汪汪token失效');
$.setdata('', 'jdJoyRunToken');
$.msg($.name, '【提示】来客有礼token失效请重新获取', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token")
$.LKYLLogin = false;
break
} else {
$.LKYLLogin = true;
if (data) {
if (!data.success && data.errorCode === 'B0001') {
console.log('京东Cookie失效');
$.msg($.name, `【提示】京东cookie已失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
$.jdLogin = false;
break
} else {
const { helpStatus } = data.data;
console.log(`helpStatus ${helpStatus}`)
if (helpStatus=== 'help_full') {
console.log(`您的邀请助力机会已耗尽\n`)
break;
} else if (helpStatus=== 'cannot_help') {
console.log(`已给该好友 ${item} 助力过或者此friendPin是你自己\n`)
continue;
} else if (helpStatus=== 'invite_full') {
console.log(`助力失败,该好友 ${item} 已经满3人给他助力了,无需您再次助力\n`)
continue;
} else if (helpStatus=== 'can_help') {
console.log(`开始给好友 ${item} 助力\n`)
const LKYL_DATA = await helpInviteFriend(item);
if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) {
console.log('来客有礼宠汪汪token失效');
$.setdata('', 'jdJoyRunToken');
$.msg($.name, '【提示】来客有礼token失效请重新获取', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token")
$.LKYLLogin = false;
break
} else {
$.LKYLLogin = true;
}
}
$.jdLogin = true;
}
$.jdLogin = true;
}
}
// if ($.inviteReward > 0) {
@ -293,8 +295,8 @@ function enterRoom(invitePin) {
$.get(options, (err, resp, data) => {
try {
if (err) {
$.log('API请求失败')
$.logErr(JSON.stringify(err));
$.log(`${$.name} API请求失败`)
$.log(JSON.stringify(err))
} else {
data = JSON.parse(data);
// console.log('进入房间', data)