This commit is contained in:
Faker 2022-06-14 10:02:29 +08:00
parent fe71d16d00
commit 0feea70e8b
3 changed files with 648 additions and 134 deletions

View File

@ -29,8 +29,8 @@ const token = [
"4BE1B58FE1360409A5967CAD1127B5A8",
"DBD58C7DDEB7D5EE3E99C164755C0BEE",
"3B27B2B9E70249C339D66F27B7E133F0",
"70E81DD8CF06D043FE1FD2DB60B59987",
"572B5331C2303ABFF034700EDDFE2B41",
"83E3C2227A9EEF3CC3A427DD79CB9902",
"CA62BF5DC17D2B1427EAEA0C7A1215C7",
"979F3F329012E8BE0D64DA1B7D6F024B",
"1C963AA3BBBD0396784BD0CA527BCDF8",
"C5FD1482A207F2CC65570F8FBC492C9A",
@ -47,7 +47,7 @@ const token = [
"7D7E23BB728C9D7425C776BDC8943D10",
"9F75D813CBE3D1F9B146F002FEA4FF2D",
"CCB11192ED79F4AF11EABBD732B26874",
"85B78F013645D1EC53D5F3974528654A"
"CA62BF5DC17D2B1427EAEA0C7A1215C7"
]
if ($.isNode()) {

540
jd_lzdz1_customized613.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,28 +1,29 @@
/*
种豆得豆 脚本更新地址https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_plantBean.js
更新时间2021-04-9
种豆得豆 脚本更新地址jd_plantBean.js
更新时间2021-08-20
活动入口京东APP我的-更多工具-种豆得豆
已支持IOS京东多账号,云端多京东账号
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
会自动关注任务中的店铺跟商品介意者勿使用
互助码shareCode请先手动运行脚本查看打印可看到
每个京东账号每天只能帮助3个人多出的助力码将会助力失败
=====================================Quantumult X=================================
[task_local]
1 7-21/2 * * * https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_plantBean.js, tag=种豆得豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png, enabled=true
1 7-21/2 * * * https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_plantBean.js, tag=种豆得豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png, enabled=true
=====================================Loon================================
[Script]
cron "1 7-21/2 * * *" script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_plantBean.js,tag=京东种豆得豆
cron "1 7-21/2 * * *" script-path=https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_plantBean.js,tag=京东种豆得豆
======================================Surge==========================
京东种豆得豆 = type=cron,cronexp="1 7-21/2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_plantBean.js
京东种豆得豆 = type=cron,cronexp="1 7-21/2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_plantBean.js
====================================小火箭=============================
京东种豆得豆 = type=cron,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_plantBean.js, cronexpr="1 7-21/2 * * *", timeout=3600, enable=true
京东种豆得豆 = type=cron,script-path=https://raw.githubusercontent.com/shufflewzc/faker2/main/jd_plantBean.js, cronexpr="1 7-21/2 * * *", timeout=3600, enable=true
*/
const $ = new Env('京东种豆得豆');
const $ = new Env('种豆得豆');
//Node.js用户请在jdCookie.js处填写京东ck;
//ios等软件用户直接用NobyDa的jd cookie
let jdNotify = true;//是否开启静默运行。默认true开启
@ -32,12 +33,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action';
//助力好友分享码(最多3个,否则后面的助力失败)
//此此内容是IOS用户下载脚本到本地使用填写互助码的地方同一京东账号的好友互助码请使用@符号隔开。
//下面给出两个账号的填写示例iOS只支持2个京东账号
let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好友的shareCode
//账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
'lsvcdmfjrraodhrrvhcfiz7iye@o7eiltak46s2x3mao6ugdiywqv6t56rymtxfe4q@e7lhibzb3zek2zegsqjmjagw4c3zvnit3ipzuci@olmijoxgmjuty7323i6ijrv5tdhd32kefogty5i@gf2njfitdloxldekzam2flrji4@mq65ksgdrkobhiyvkoqfi7ff7i5ac3f4ijdgqji@wkmb7lejrmax2avk7bszvx7s74@4npkonnsy7xi3acvl3goi4ga5gpmpv2km4yj3di@rj7s6mzlk7uognpgua34bszhyf4cpqqtj5vfhta@olmijoxgmjutyif5p35uuja6gwp2ulsp2x6fjoi@dzfuhp3b2fz7mnj5ndxxqsradgg5bsrhuof2mbq',
//账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
'lsvcdmfjrraodhrrvhcfiz7iye@o7eiltak46s2x3mao6ugdiywqv6t56rymtxfe4q@e7lhibzb3zek2zegsqjmjagw4c3zvnit3ipzuci@olmijoxgmjuty7323i6ijrv5tdhd32kefogty5i@gf2njfitdloxldekzam2flrji4@mq65ksgdrkobhiyvkoqfi7ff7i5ac3f4ijdgqji@wkmb7lejrmax2avk7bszvx7s74@4npkonnsy7xi3acvl3goi4ga5gpmpv2km4yj3di@rj7s6mzlk7uognpgua34bszhyf4cpqqtj5vfhta@olmijoxgmjutyif5p35uuja6gwp2ulsp2x6fjoi@dzfuhp3b2fz7mnj5ndxxqsradgg5bsrhuof2mbq',
]
let shareCodes = []
let allMessage = ``;
let currentRoundId = null;//本期活动id
let lastRoundId = null;//上期id
@ -45,6 +41,10 @@ let roundList = [];
let awardState = '';//上期活动的京豆是否收取
let randomCount = $.isNode() ? 20 : 5;
let num;
let llerror=false;
$.newShareCode = [];
let NowHour = new Date().getHours();
let lnrun = 0;
!(async () => {
await requireConfig();
if (!cookiesArr[0]) {
@ -71,9 +71,14 @@ let num;
message = '';
subTitle = '';
option = {};
await shareCodesFormat();
lnrun++;
await jdPlantBean();
await showMsg();
if(lnrun == 3){
console.log(`\n【访问接口次数达到3次休息一分钟.....】\n`);
await $.wait(60*1000);
lnrun = 0;
}
//await showMsg();
}
}
if ($.isNode() && allMessage) {
@ -89,22 +94,21 @@ async function jdPlantBean() {
try {
console.log(`获取任务及基本信息`)
await plantBeanIndex();
if ($.plantBeanIndexResult.errorCode === 'PB101') {
console.log(`\n活动太火爆了,还是去买买买吧!\n`)
return
}
if ($.plantBeanIndexResult && $.plantBeanIndexResult.code === '0' && $.plantBeanIndexResult.data) {
// console.log(plantBeanIndexResult.data.taskList);
if(llerror)
return;
for (let i = 0; i < $.plantBeanIndexResult.data.roundList.length; i++) {
if ($.plantBeanIndexResult.data.roundList[i].roundState === "2") {
num = i
break
}
}
// console.log(plantBeanIndexResult.data.taskList);
if ($.plantBeanIndexResult && $.plantBeanIndexResult.code === '0' && $.plantBeanIndexResult.data) {
const shareUrl = $.plantBeanIndexResult.data.jwordShareInfo.shareUrl
$.myPlantUuid = getParam(shareUrl, 'plantUuid')
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】${$.myPlantUuid}\n`);
jdPlantBeanShareArr.push($.myPlantUuid)
roundList = $.plantBeanIndexResult.data.roundList;
currentRoundId = roundList[num].roundId;//本期的roundId
lastRoundId = roundList[num - 1].roundId;//上期的roundId
@ -113,22 +117,29 @@ async function jdPlantBean() {
subTitle = `【京东昵称】${$.plantBeanIndexResult.data.plantUserInfo.plantNickName}`;
message += `【上期时间】${roundList[num - 1].dateDesc.replace('上期 ', '')}\n`;
message += `【上期成长值】${roundList[num - 1].growth}\n`;
await $.wait(1000);
await receiveNutrients();//定时领取营养液
await doHelp();//助力
await $.wait(2000);
await doTask();//做日常任务
await $.wait(5000);
// await doEgg();
await stealFriendWater();
await $.wait(2000);
await doCultureBean();
await $.wait(1000);
await doGetReward();
await $.wait(1000);
await showTaskProcess();
await $.wait(1000);
await plantShareSupportList();
await $.wait(1000);
} else {
console.log(`种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}`);
}
} catch (e) {
$.logErr(e);
const errMsg = `京东账号${$.index} ${$.nickName || $.UserName}\n任务执行异常,请检查执行日志 ‼️‼️`;
if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg);
// if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg);
$.msg($.name, '', `${errMsg}`)
}
}
@ -164,6 +175,8 @@ async function doGetReward() {
}
async function doCultureBean() {
await plantBeanIndex();
if(llerror)
return;
if ($.plantBeanIndexResult && $.plantBeanIndexResult.code === '0' && $.plantBeanIndexResult.data) {
const plantBeanRound = $.plantBeanIndexResult.data.roundList[num]
if (plantBeanRound.roundState === '2') {
@ -251,6 +264,7 @@ async function doTask() {
console.log(`\n开始做 ${item.taskName}任务`);
// $.receiveNutrientsTaskRes = await receiveNutrientsTask(item.taskType);
await receiveNutrientsTask(item.taskType);
await $.wait(3000);
console.log(`${item.taskName}任务结果:${JSON.stringify($.receiveNutrientsTaskRes)}\n`);
}
if (item.taskType === 3) {
@ -393,6 +407,8 @@ async function doTask() {
function showTaskProcess() {
return new Promise(async resolve => {
await plantBeanIndex();
if(llerror)
return;
if ($.plantBeanIndexResult && $.plantBeanIndexResult.code === '0' && $.plantBeanIndexResult.data) {
$.taskList = $.plantBeanIndexResult.data.taskList;
if ($.taskList && $.taskList.length > 0) {
@ -407,38 +423,7 @@ function showTaskProcess() {
resolve()
})
}
//助力好友
async function doHelp() {
for (let plantUuid of newShareCodes) {
console.log(`开始助力京东账号${$.index} - ${$.nickName}的好友: ${plantUuid}`);
if (!plantUuid) continue;
if (plantUuid === $.myPlantUuid) {
console.log(`\n跳过自己的plantUuid\n`)
continue
}
await helpShare(plantUuid);
if ($.helpResult && $.helpResult.code === '0' && $.helpResult.data) {
// console.log(`助力好友结果: ${JSON.stringify($.helpResult.data.helpShareRes)}`);
if ($.helpResult.data.helpShareRes) {
if ($.helpResult.data.helpShareRes.state === '1') {
console.log(`助力好友${plantUuid}成功`)
console.log(`${$.helpResult.data.helpShareRes.promptText}\n`);
} else if ($.helpResult.data.helpShareRes.state === '2') {
console.log('您今日助力的机会已耗尽,已不能再帮助好友助力了\n');
break;
} else if ($.helpResult.data.helpShareRes.state === '3') {
console.log('该好友今日已满9人助力/20瓶营养液,明天再来为Ta助力吧\n')
} else if ($.helpResult.data.helpShareRes.state === '4') {
console.log(`${$.helpResult.data.helpShareRes.promptText}\n`)
} else {
console.log(`助力其他情况:${JSON.stringify($.helpResult.data.helpShareRes)}`);
}
}
} else {
console.log(`助力好友失败: ${JSON.stringify($.helpResult)}`);
}
}
}
function showMsg() {
$.log(`\n${message}\n`);
jdNotify = $.getdata('jdPlantBeanNotify') ? $.getdata('jdPlantBeanNotify') : jdNotify;
@ -548,58 +533,47 @@ async function helpShare(plantUuid) {
console.log(`助力结果的code:${$.helpResult && $.helpResult.code}`);
}
async function plantBeanIndex() {
llerror=false;
$.plantBeanIndexResult = await request('plantBeanIndex'); //plantBeanIndexBody
if ($.plantBeanIndexResult.errorCode === 'PB101') {
console.log(`\n活动太火爆了,还是去买买买吧!\n`)
llerror=true;
return
}
function readShareCode() {
return new Promise(async resolve => {
$.get({url: `http://transfer.nz.lu/bean`, timeout: 10000}, (err, resp, data) => {
try {
if (err) {
console.log(JSON.stringify(err))
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if (data) {
console.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
data = JSON.parse(data);
if ($.plantBeanIndexResult.errorCode) {
console.log(`获取任务及基本信息出错10秒后重试\n`)
await $.wait(10000);
$.plantBeanIndexResult = await request('plantBeanIndex');
if ($.plantBeanIndexResult.errorCode === 'PB101') {
console.log(`\n活动太火爆了,还是去买买买吧!\n`)
llerror=true;
return
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
if ($.plantBeanIndexResult.errorCode) {
console.log(`获取任务及基本信息出错30秒后重试\n`)
await $.wait(30000);
$.plantBeanIndexResult = await request('plantBeanIndex');
if ($.plantBeanIndexResult.errorCode === 'PB101') {
console.log(`\n活动太火爆了,还是去买买买吧!\n`)
llerror=true;
return
}
})
await $.wait(15000);
resolve()
})
}
//格式化助力码
function shareCodesFormat() {
return new Promise(async resolve => {
// console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
newShareCodes = [];
if ($.shareCodesArr[$.index - 1]) {
newShareCodes = $.shareCodesArr[$.index - 1].split('@');
} else {
console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
newShareCodes = shareCodes[tempIndex].split('@');
if ($.plantBeanIndexResult.errorCode) {
console.log(`获取任务及基本信息失败,活动异常,换个时间再试试吧....`)
console.log("错误代码;" + $.plantBeanIndexResult.errorCode)
llerror=true;
return
}
const readShareCodeRes = await readShareCode();
if (readShareCodeRes && readShareCodeRes.code === 200) {
newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
}
console.log(`${$.index}个京东账号将要助力的好友${JSON.stringify(newShareCodes)}`)
resolve();
})
}
function requireConfig() {
return new Promise(resolve => {
console.log('开始获取种豆得豆配置文件\n')
//console.log('开始获取种豆得豆配置文件\n')
notify = $.isNode() ? require('./sendNotify') : '';
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const jdPlantBeanShareCodes = $.isNode() ? require('./jdPlantBeanShareCodes.js') : '';
const jdPlantBeanShareCodes = '';
//IOS等用户直接用NobyDa的jd cookie
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
@ -621,10 +595,10 @@ function requireConfig() {
})
} else {
if ($.getdata('jd_plantbean_inviter')) $.shareCodesArr = $.getdata('jd_plantbean_inviter').split('\n').filter(item => !!item);
console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('jd_plantbean_inviter') ? $.getdata('jd_plantbean_inviter') : '暂无'}\n`);
//console.log(`\nBoxJs设置的${$.name}好友邀请码:${$.getdata('jd_plantbean_inviter') ? $.getdata('jd_plantbean_inviter') : '暂无'}\n`);
}
// console.log(`\n种豆得豆助力码::${JSON.stringify($.shareCodesArr)}`);
console.log(`您提供了${$.shareCodesArr.length}个账号的种豆得豆助力码\n`);
//console.log(`您提供了${$.shareCodesArr.length}个账号的种豆得豆助力码\n`);
resolve()
})
}
@ -635,7 +609,7 @@ function requestGet(function_id, body = {}) {
body["monitor_source"] = "plant_app_plant_index";
body["monitor_refer"] = "";
return new Promise(async resolve => {
await $.wait(2000);
await $.wait(5000);
const option = {
url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld`,
headers: {
@ -713,7 +687,7 @@ function TotalBean() {
}
function request(function_id, body = {}) {
return new Promise(async resolve => {
await $.wait(2000);
await $.wait(5000);
$.post(taskUrl(function_id, body), (err, resp, data) => {
try {
if (err) {
@ -732,7 +706,7 @@ function request(function_id, body = {}){
})
}
function taskUrl(function_id, body) {
body["version"] = "9.2.4.0";
body["version"] = "9.2.4.1";
body["monitor_source"] = "plant_app_plant_index";
body["monitor_refer"] = "";
return {