This commit is contained in:
Faker 2022-06-06 10:31:33 +08:00
parent 3675dc79d5
commit 8aac315fd6
7 changed files with 684 additions and 293 deletions

File diff suppressed because one or more lines are too long

View File

@ -25,18 +25,14 @@ let vender=''
let num=0 let num=0
let shopname='' let shopname=''
const token = [ const token = [
"156E859B3A314171CA34B780C19CB215",
"35BA76ED53A953E03F77EE5379C28BE5", "35BA76ED53A953E03F77EE5379C28BE5",
"4BE1B58FE1360409A5967CAD1127B5A8", "4BE1B58FE1360409A5967CAD1127B5A8",
"B30FC91ED327EE2E1C7C8B2214D8751A", "CE4C976E0F6B9C0C10ECCC68A9E2B885",
"3119848AE10A9E0858685099EB6C28CC",
"A7DDDEAE3438B27260BDC8B1A555CE6F",
"3B27B2B9E70249C339D66F27B7E133F0", "3B27B2B9E70249C339D66F27B7E133F0",
"C031053EDBD2C047C072C53F80D82577", "C031053EDBD2C047C072C53F80D82577",
"8E3DB8D17AD97471F53959CF2F2439FE", "3458BF494FAEA0AEA7C34E36EB587A33",
"89425692E74B610F07E9783B75CA299B", "979F3F329012E8BE0D64DA1B7D6F024B",
"98640F3DCA10BB955E8039117A1F819F", "3B864BF96848A44E170A26D2791E0AE3",
"92E3956A3FAF71B6922B0AA8D9ED070A",
"1C963AA3BBBD0396784BD0CA527BCDF8", "1C963AA3BBBD0396784BD0CA527BCDF8",
"C5FD1482A207F2CC65570F8FBC492C9A", "C5FD1482A207F2CC65570F8FBC492C9A",
"5CF1A3455369BDB3D1153D9FC974CAFA", "5CF1A3455369BDB3D1153D9FC974CAFA",
@ -44,14 +40,14 @@ const token = [
"5B43A702C5CC14509CD8FB6F725326FC", "5B43A702C5CC14509CD8FB6F725326FC",
"451389BCDC4E8B258DD3F21CDB827589", "451389BCDC4E8B258DD3F21CDB827589",
"57970BD464D679B43A7A0F5585F42677", "57970BD464D679B43A7A0F5585F42677",
"21CEF5FF054814ADC61753FFFF417F03", "8029DFB0D9ADF5C6E96AF7D542B3E715",
"A47418AED7F226A649E8886FCE2E02B3", "A47418AED7F226A649E8886FCE2E02B3",
"65604889E08858A41E2DDB76D075C3BA", "65604889E08858A41E2DDB76D075C3BA",
"B7F1BE70638D6747223271745CB0D505",
"21CEF5FF054814ADC61753FFFF417F03",
"B6AF39DB2F83BEA76726BF0D71CCDDD8",
"9B57C79395931A570FB01264D48E9673",
"4706B9DB78BBCC66BCB76862EB147AD2", "4706B9DB78BBCC66BCB76862EB147AD2",
"F96D0FC8CC217B855988CA26E2A8BE74",
"809569E3816B2C76210BFF8DB3F2766E",
"21CEF5FF054814ADC61753FFFF417F03",
"3B864BF96848A44E170A26D2791E0AE3",
"85B78F013645D1EC53D5F3974528654A" "85B78F013645D1EC53D5F3974528654A"
] ]

167
jd_insight.js Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

@ -74,14 +74,6 @@ let lnruns = 0;
option = {}; option = {};
await jdPlantBean(); await jdPlantBean();
await $.wait(2 * 1000); await $.wait(2 * 1000);
lnrun++;
await doHelp();
if (lnrun == 3) {
console.log(`\n【访问接口次数达到3次休息一分钟.....】\n`);
await $.wait(60 * 1000);
lnrun = 0;
}
await $.wait(3 * 1000);
} }
} }
if ($.isNode() && allMessage) { if ($.isNode() && allMessage) {
@ -118,6 +110,14 @@ async function jdPlantBean() {
awardState = roundList[num - 1].awardState; awardState = roundList[num - 1].awardState;
$.taskList = $.plantBeanIndexResult.data.taskList; $.taskList = $.plantBeanIndexResult.data.taskList;
subTitle = `【京东昵称】${$.plantBeanIndexResult.data.plantUserInfo.plantNickName}`; subTitle = `【京东昵称】${$.plantBeanIndexResult.data.plantUserInfo.plantNickName}`;
lnrun++;
await doHelp();
if (lnrun == 3) {
console.log(`\n【访问接口次数达到3次休息半分钟.....】\n`);
await $.wait(30 * 1000);
lnrun = 0;
}
await $.wait(3 * 1000);
} else { } else {
console.log(`种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}`); console.log(`种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}`);
} }
@ -125,7 +125,7 @@ async function jdPlantBean() {
$.logErr(e); $.logErr(e);
const errMsg = `京东账号${$.index} ${$.nickName || $.UserName}\n任务执行异常,请检查执行日志 ‼️‼️`; const errMsg = `京东账号${$.index} ${$.nickName || $.UserName}\n任务执行异常,请检查执行日志 ‼️‼️`;
// if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg); // if ($.isNode()) await notify.sendNotify(`${$.name}`, errMsg);
$.msg($.name, '', `${errMsg}`) //$.msg($.name, '', `${errMsg}`)
} }
} }
//助力好友 //助力好友
@ -148,9 +148,9 @@ async function doHelp() {
await $.wait(30 * 1000); await $.wait(30 * 1000);
lnruns = 0; lnruns = 0;
} }
if ($.helpResult && $.helpResult.code === '0') { if ($.helpResult && $.helpResult.code === '0' && $.helpResult.data) {
console.log(`助力好友结果: ${JSON.stringify($.helpResult.data.helpShareRes)}`); console.log(`助力好友结果: ${JSON.stringify($.helpResult.data.helpShareRes)}`);
if ($.helpResult.data.helpShareRes) { if ($.helpResult.data && $.helpResult.data.helpShareRes) {
if ($.helpResult.data.helpShareRes.state === '1') { if ($.helpResult.data.helpShareRes.state === '1') {
console.log(`助力好友${plantUuid}成功`) console.log(`助力好友${plantUuid}成功`)
console.log(`${$.helpResult.data.helpShareRes.promptText}\n`); console.log(`${$.helpResult.data.helpShareRes.promptText}\n`);

345
jd_supermh.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -6,16 +6,6 @@
* 上一作者说了每天最多300个商店总上限为500个jd_unsubscribe.js我已更新为批量取关版 * 上一作者说了每天最多300个商店总上限为500个jd_unsubscribe.js我已更新为批量取关版
* 请提前取关至少250个商店确保京东试用脚本正常运行 * 请提前取关至少250个商店确保京东试用脚本正常运行
* @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js * @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js
参考环境变量配置如下
export JD_TRY="true"
export JD_TRY_PLOG="true" #是否打印输出到日志
export JD_TRY_PASSZC="true" #过滤种草官类试用
export JD_TRY_MAXLENGTH="50" #商品数组的最大长度
export JD_TRY_APPLYINTERVAL="5000" #商品试用之间和获取商品之间的间隔
export JD_TRY_APPLYNUMFILTER="100000" #过滤大于设定值的已申请人数
export JD_TRY_MINSUPPLYNUM="1" #最小提供数量
export JD_TRY_SENDNUM="10" #每隔多少账号发送一次通知不需要可以不用设置
export JD_TRY_UNIFIED="false" 默认采用不同试用组
cron "4 1-22/8 * * *" jd_try.js, tag:京东试用 cron "4 1-22/8 * * *" jd_try.js, tag:京东试用
*/ */
@ -130,7 +120,7 @@ let args_xh = {
* 可设置环境变量JD_TRY_APPLYINTERVAL * 可设置环境变量JD_TRY_APPLYINTERVAL
* 默认为3000也就是3秒 * 默认为3000也就是3秒
* */ * */
applyInterval: process.env.JD_TRY_APPLYINTERVAL * 1 || 5000, applyInterval: process.env.JD_TRY_APPLYINTERVAL * 1 || 10000,
/* /*
* 商品数组的最大长度通俗来说就是即将申请的商品队列长度 * 商品数组的最大长度通俗来说就是即将申请的商品队列长度
* 例如设置为20当第一次获取后获得12件过滤后剩下5件将会进行第二次获取过滤后加上第一次剩余件数 * 例如设置为20当第一次获取后获得12件过滤后剩下5件将会进行第二次获取过滤后加上第一次剩余件数
@ -145,7 +135,7 @@ let args_xh = {
* 例如B商品是种草官专属试用商品下面设置为true即使你是种草官账号A商品也不会被添加到待提交试用组 * 例如B商品是种草官专属试用商品下面设置为true即使你是种草官账号A商品也不会被添加到待提交试用组
* 可设置环境变量JD_TRY_PASSZC默认为true * 可设置环境变量JD_TRY_PASSZC默认为true
* */ * */
passZhongCao: process.env.JD_TRY_PASSZC === 'true' || true, passZhongCao: process.env.JD_TRY_PASSZC === 'false' || true,
/* /*
* 是否打印输出到日志考虑到如果试用组长度过大例如100以上如果每个商品检测都打印一遍日志长度会非常长 * 是否打印输出到日志考虑到如果试用组长度过大例如100以上如果每个商品检测都打印一遍日志长度会非常长
* 打印的优点清晰知道每个商品为什么会被过滤哪个商品被添加到了待提交试用组 * 打印的优点清晰知道每个商品为什么会被过滤哪个商品被添加到了待提交试用组
@ -214,6 +204,8 @@ let args_xh = {
$.nowTabIdIndex = 0; $.nowTabIdIndex = 0;
$.nowPage = 1; $.nowPage = 1;
$.nowItem = 1; $.nowItem = 1;
if (!args_xh.unified) { if (!args_xh.unified) {
trialActivityIdList = [] trialActivityIdList = []
trialActivityTitleList = [] trialActivityTitleList = []
@ -248,7 +240,7 @@ let args_xh = {
} }
await try_apply(trialActivityTitleList[i], trialActivityIdList[i]) await try_apply(trialActivityTitleList[i], trialActivityIdList[i])
//console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`) //console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`)
const waitTime = generateRandomInteger(5000, 8000); const waitTime = generateRandomInteger(args_xh.applyInterval, 13000);
console.log(`随机等待${waitTime}ms后继续`); console.log(`随机等待${waitTime}ms后继续`);
await $.wait(waitTime); await $.wait(waitTime);
} }