解决萌宠以及种豆脚本部分账号火爆或者风控导致脚本执行中断情况

This commit is contained in:
lxk0301
2021-01-16 16:04:48 +08:00
parent 6d411581e3
commit 1c3ee4bd8c
2 changed files with 85 additions and 77 deletions

104
jd_pet.js
View File

@@ -1,6 +1,6 @@
/* /*
东东萌宠 更新地址: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js 东东萌宠 更新地址: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js
更新时间2021-01-10 更新时间2021-01-16
已支持IOS双京东账号,Node.js支持N个京东账号 已支持IOS双京东账号,Node.js支持N个京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
@@ -79,58 +79,62 @@ let randomCount = $.isNode() ? 20 : 5;
$.done(); $.done();
}) })
async function jdPet() { async function jdPet() {
//查询jd宠物信息 try {
const initPetTownRes = await request('initPetTown'); //查询jd宠物信息
message = `【京东账号${$.index}${$.nickName}\n`; const initPetTownRes = await request('initPetTown');
if (initPetTownRes.code === '0' && initPetTownRes.resultCode === '0' && initPetTownRes.message === 'success') { message = `【京东账号${$.index}${$.nickName}\n`;
$.petInfo = initPetTownRes.result; if (initPetTownRes.code === '0' && initPetTownRes.resultCode === '0' && initPetTownRes.message === 'success') {
if ($.petInfo.userStatus === 0) { $.petInfo = initPetTownRes.result;
$.msg($.name, '', `【提示】京东账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多开启`, { "open-url": "openapp.jdmoble://" }); if ($.petInfo.userStatus === 0) {
return $.msg($.name, '', `【提示】京东账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多开启`, { "open-url": "openapp.jdmoble://" });
} return
if (!$.petInfo.goodsInfo) {
$.msg($.name, '', `【提示】京东账号${$.index}${$.nickName}\n暂未选购新的商品`, { "open-url": "openapp.jdmoble://" });
if ($.isNode()) await notify.sendNotify(`${$.name} - ${$.index} - ${$.nickName}`, `【提示】京东账号${$.index}${$.nickName}\n暂未选购新的商品`);
return
}
goodsUrl = $.petInfo.goodsInfo && $.petInfo.goodsInfo.goodsUrl;
// option['media-url'] = goodsUrl;
// console.log(`初始化萌宠信息完成: ${JSON.stringify(petInfo)}`);
if ($.petInfo.petStatus === 5) {
await slaveHelp();//可以兑换而没有去兑换,也能继续助力好友
option['open-url'] = "openApp.jdMobile://";
$.msg($.name, `【提醒⏰】${$.petInfo.goodsInfo.goodsName}已可领取`, '请去京东APP或微信小程序查看', option);
if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `京东账号${$.index} ${$.nickName}\n${$.petInfo.goodsInfo.goodsName}已可领取`);
} }
return if (!$.petInfo.goodsInfo) {
} else if ($.petInfo.petStatus === 6) { $.msg($.name, '', `【提示】京东账号${$.index}${$.nickName}\n暂未选购新的商品`, { "open-url": "openapp.jdmoble://" });
await slaveHelp();//已领取红包,但未领养新的,也能继续助力好友 if ($.isNode()) await notify.sendNotify(`${$.name} - ${$.index} - ${$.nickName}`, `【提示】京东账号${$.index}${$.nickName}\n暂未选购新的商品`);
option['open-url'] = "openApp.jdMobile://"; return
$.msg($.name, `【提醒⏰】已领取红包,但未继续领养新的物品`, '请去京东APP或微信小程序继续领养', option);
if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `京东账号${$.index} ${$.nickName}\n已领取红包,但未继续领养新的物品`);
} }
return goodsUrl = $.petInfo.goodsInfo && $.petInfo.goodsInfo.goodsUrl;
} // option['media-url'] = goodsUrl;
console.log(`\n【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】${$.petInfo.shareCode}\n`); // console.log(`初始化萌宠信息完成: ${JSON.stringify(petInfo)}`);
await taskInit(); if ($.petInfo.petStatus === 5) {
if ($.taskInit.resultCode === '9999' || !$.taskInit.result) { await slaveHelp();//可以兑换而没有去兑换,也能继续助力好友
console.log('初始化任务异常, 请稍后再试'); option['open-url'] = "openApp.jdMobile://";
return $.msg($.name, `【提醒⏰】${$.petInfo.goodsInfo.goodsName}已可领取`, '请去京东APP或微信小程序查看', option);
} if ($.isNode()) {
$.taskInfo = $.taskInit.result; await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `京东账号${$.index} ${$.nickName}\n${$.petInfo.goodsInfo.goodsName}已可领取`);
}
return
} else if ($.petInfo.petStatus === 6) {
await slaveHelp();//已领取红包,但未领养新的,也能继续助力好友
option['open-url'] = "openApp.jdMobile://";
$.msg($.name, `【提醒⏰】已领取红包,但未继续领养新的物品`, '请去京东APP或微信小程序继续领养', option);
if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `京东账号${$.index} ${$.nickName}\n已领取红包,但未继续领养新的物品`);
}
return
}
console.log(`\n【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】${$.petInfo.shareCode}\n`);
await taskInit();
if ($.taskInit.resultCode === '9999' || !$.taskInit.result) {
console.log('初始化任务异常, 请稍后再试');
return
}
$.taskInfo = $.taskInit.result;
await petSport();//遛弯 await petSport();//遛弯
await slaveHelp();//助力好友 await slaveHelp();//助力好友
await masterHelpInit();//获取助力的信息 await masterHelpInit();//获取助力的信息
await doTask();//做日常任务 await doTask();//做日常任务
await feedPetsAgain();//再次投食 await feedPetsAgain();//再次投食
await energyCollect();//收集好感度 await energyCollect();//收集好感度
await showMsg(); await showMsg();
console.log('全部任务完成, 如果帮助到您可以点下🌟STAR鼓励我一下, 明天见~'); console.log('全部任务完成, 如果帮助到您可以点下🌟STAR鼓励我一下, 明天见~');
} else if (initPetTownRes.code === '0'){ } else if (initPetTownRes.code === '0'){
console.log(`初始化萌宠失败: ${initPetTownRes.message}`); console.log(`初始化萌宠失败: ${initPetTownRes.message}`);
}
} catch (e) {
$.logErr(e)
} }
} }
// 收取所有好感度 // 收取所有好感度

View File

@@ -1,6 +1,6 @@
/* /*
种豆得豆 脚本更新地址https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js 种豆得豆 脚本更新地址https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js
更新时间2020-12-31 更新时间2021-1-16
已支持IOS京东双账号,云端N个京东账号 已支持IOS京东双账号,云端N个京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
注:会自动关注任务中的店铺跟商品,介意者勿使用。 注:会自动关注任务中的店铺跟商品,介意者勿使用。
@@ -81,32 +81,36 @@ let randomCount = $.isNode() ? 20 : 5;
}) })
async function jdPlantBean() { async function jdPlantBean() {
console.log(`获取任务及基本信息`) try {
await plantBeanIndex(); console.log(`获取任务及基本信息`)
// console.log(plantBeanIndexResult.data.taskList); await plantBeanIndex();
if ($.plantBeanIndexResult.code === '0') { // console.log(plantBeanIndexResult.data.taskList);
const shareUrl = $.plantBeanIndexResult.data.jwordShareInfo.shareUrl if ($.plantBeanIndexResult.code === '0') {
$.myPlantUuid = getParam(shareUrl, 'plantUuid') const shareUrl = $.plantBeanIndexResult.data.jwordShareInfo.shareUrl
console.log(`\n【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】${$.myPlantUuid}\n`); $.myPlantUuid = getParam(shareUrl, 'plantUuid')
roundList = $.plantBeanIndexResult.data.roundList; console.log(`\n【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】${$.myPlantUuid}\n`);
currentRoundId = roundList[1].roundId;//本期的roundId roundList = $.plantBeanIndexResult.data.roundList;
lastRoundId = roundList[0].roundId;//期的roundId currentRoundId = roundList[1].roundId;//期的roundId
awardState = roundList[0].awardState; lastRoundId = roundList[0].roundId;//上期的roundId
$.taskList = $.plantBeanIndexResult.data.taskList; awardState = roundList[0].awardState;
subTitle = `【京东昵称】${$.plantBeanIndexResult.data.plantUserInfo.plantNickName}`; $.taskList = $.plantBeanIndexResult.data.taskList;
message += `上期时间${roundList[0].dateDesc.replace('上期 ', '')}\n`; subTitle = `京东昵称${$.plantBeanIndexResult.data.plantUserInfo.plantNickName}`;
message += `【上期成长值${roundList[0].growth}\n`; message += `【上期时间${roundList[0].dateDesc.replace('上期 ', '')}\n`;
await receiveNutrients();//定时领取营养液 message += `【上期成长值】${roundList[0].growth}\n`;
await doHelp();//助力 await receiveNutrients();//定时领取营养液
await doTask();//做日常任务 await doHelp();//助力
await doEgg(); await doTask();//做日常任务
await stealFriendWater(); await doEgg();
await doCultureBean(); await stealFriendWater();
await doGetReward(); await doCultureBean();
await showTaskProcess(); await doGetReward();
await plantShareSupportList(); await showTaskProcess();
} else { await plantShareSupportList();
console.log(`种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}`); } else {
console.log(`种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}`);
}
} catch (e) {
$.logErr(e);
} }
} }
async function doGetReward() { async function doGetReward() {