yyds 2022-02-27 00:37:48 +08:00
parent 7eec94376c
commit de59620530
1 changed files with 289 additions and 161 deletions

View File

@ -24,7 +24,7 @@ cron "5 6-18/6 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/maste
jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js
*/ */
const $ = new Env('东东农场_内部互助'); const $ = new Env('东东农场互助');
let cookiesArr = [], cookie = '', isBox = false, notify,allMessage = ''; let cookiesArr = [], cookie = '', isBox = false, notify,allMessage = '';
//助力好友分享码(最多3个,否则后面的助力失败),原因:京东农场每人每天只有3次助力机会 //助力好友分享码(最多3个,否则后面的助力失败),原因:京东农场每人每天只有3次助力机会
//此此内容是IOS用户下载脚本到本地使用填写互助码的地方同一京东账号的好友互助码请使用@符号隔开。 //此此内容是IOS用户下载脚本到本地使用填写互助码的地方同一京东账号的好友互助码请使用@符号隔开。
@ -37,7 +37,47 @@ let jdNotify = false;//是否关闭通知false打开通知推送true关闭
let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水 let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
const JD_API_HOST = 'https://api.m.jd.com/client.action'; const JD_API_HOST = 'https://api.m.jd.com/client.action';
const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`; const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
let NowHour = new Date().getHours();
let llhelp=true;
if ($.isNode() && process.env.CC_NOHELPAFTER8) {
if (process.env.CC_NOHELPAFTER8=="true"){
if (NowHour>8){
llhelp=false;
console.log(`现在是9点后时段不启用互助....`);
}
}
}
const fs = require('fs');
let boolneedUpdate=false;
let strShare = './Fruit_ShareCache.json';
let Fileexists = fs.existsSync(strShare);
let TempShareCache = [];
if (Fileexists) {
console.log("检测到东东农场缓存文件Fruit_ShareCache.json载入...");
TempShareCache = fs.readFileSync(strShare, 'utf-8');
if (TempShareCache) {
TempShareCache = TempShareCache.toString();
TempShareCache = JSON.parse(TempShareCache);
}
}
let WP_APP_TOKEN_ONE = "";
if ($.isNode()) {
if (process.env.WP_APP_TOKEN_ONE) {
WP_APP_TOKEN_ONE = process.env.WP_APP_TOKEN_ONE;
}
}
if (WP_APP_TOKEN_ONE) {
console.log(`检测到已配置Wxpusher的Token启用一对一推送...`);
if (NowHour <9 || NowHour > 21) {
WP_APP_TOKEN_ONE = "";
console.log(`农场只在9点后和22点前启用一对一推送故此次暂时取消一对一推送...`);
}
} else
console.log(`检测到未配置Wxpusher的Token禁用一对一推送...`);
let lnrun=0;
let llgetshare=false;
!(async () => { !(async () => {
await requireConfig(); await requireConfig();
@ -45,53 +85,87 @@ const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%2
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
return; return;
} }
console.log('开始收集您的互助码,用于账号内部互助,请稍等...'); if (llhelp) {
for (let i = 0; i < cookiesArr.length; i++) { console.log('开始收集您的互助码,用于账号内部互助,请稍等...');
if (cookiesArr[i]) { for (let i = 0; i < cookiesArr.length; i++) {
cookie = cookiesArr[i]; if (cookiesArr[i]) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) cookie = cookiesArr[i];
$.index = i + 1; $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.isLogin = true; $.index = i + 1;
$.nickName = ''; $.isLogin = true;
await TotalBean(); $.nickName = '';
if (!$.isLogin) { await TotalBean();
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
if ($.isNode()) { if ($.isNode()) {
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
} }
continue continue
}
message = '';
subTitle = '';
option = {};
$.retry = 0;
llgetshare=false;
await GetCollect();
if(llgetshare){
await $.wait(5000);
lnrun++;
}
if(lnrun==10){
console.log(`访问接口次数达到10次休息一分钟.....`);
await $.wait(60*1000);
lnrun=0;
}
}
}
if (boolneedUpdate) {
var str = JSON.stringify(TempShareCache, null, 2);
fs.writeFile(strShare, str, function (err) {
if (err) {
console.log(err);
console.log("缓存文件Fruit_ShareCache.json更新失败!");
} else {
console.log("缓存文件Fruit_ShareCache.json更新成功!");
}
})
} }
message = '';
subTitle = '';
option = {};
$.retry = 0;
await GetCollect();
}
} }
for (let i = 0; i < cookiesArr.length; i++) { for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) { if (cookiesArr[i]) {
cookie = cookiesArr[i]; cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1; $.index = i + 1;
$.isLogin = true; $.isLogin = true;
$.nickName = ''; $.nickName = '';
await TotalBean(); await TotalBean();
console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`); console.log(`\n开始【京东账号${$.index}${$.nickName || $.UserName}\n`);
if (!$.isLogin) { if (!$.isLogin) {
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
});
if ($.isNode()) { if ($.isNode()) {
await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
} }
continue continue
}
message = '';
subTitle = '';
option = {};
$.retry = 0;
lnrun++;
await jdFruit();
if (lnrun == 5) {
console.log(`访问接口次数达到5次休息一分钟.....`);
await $.wait(60 * 1000);
lnrun = 0;
}
} }
message = '';
subTitle = '';
option = {};
$.retry = 0;
await jdFruit();
}
} }
if ($.isNode() && allMessage && $.ctrTemp) { if ($.isNode() && allMessage && $.ctrTemp) {
await notify.sendNotify(`${$.name}`, `${allMessage}`) await notify.sendNotify(`${$.name}`, `${allMessage}`)
@ -118,6 +192,9 @@ async function jdFruit() {
if ($.isNode()) { if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `【京东账号${$.index}${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去京东APP或微信小程序查看`); await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `【京东账号${$.index}${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去京东APP或微信小程序查看`);
} }
if ($.isNode() && WP_APP_TOKEN_ONE) {
await notify.sendNotifybyWxPucher($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n【领取步骤】京东->我的->东东农场兑换京东红包,可以用于京东app的任意商品.`, `${$.UserName}`);
}
return return
} else if ($.farmInfo.treeState === 1) { } else if ($.farmInfo.treeState === 1) {
console.log(`\n${$.farmInfo.farmUserPro.name}种植中...\n`) console.log(`\n${$.farmInfo.farmUserPro.name}种植中...\n`)
@ -267,53 +344,66 @@ async function predictionFruit() {
} }
//浇水十次 //浇水十次
async function doTenWater() { async function doTenWater() {
jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard; try {
if ($.isNode() && process.env.FRUIT_BEAN_CARD) { jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
jdFruitBeanCard = process.env.FRUIT_BEAN_CARD; if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
} jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
await myCardInfoForFarm();
const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match(`限时翻倍`) && beanCard > 0) {
console.log(`您设置的是使用水滴换豆卡,且背包有水滴换豆卡${beanCard}张, 跳过10次浇水任务`)
return
}
if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
console.log(`\n准备浇水十次`);
let waterCount = 0;
isFruitFinished = false;
for (; waterCount < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit - $.farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
console.log(`${waterCount + 1}次浇水`);
await waterGoodForFarm();
console.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
if ($.waterResult.code === '0') {
console.log(`剩余水滴${$.waterResult.totalEnergy}g`);
if ($.waterResult.finished) {
// 已证实waterResult.finished为true表示水果可以去领取兑换了
isFruitFinished = true;
break
} else {
if ($.waterResult.totalEnergy < 10) {
console.log(`水滴不够,结束浇水`)
break
}
await gotStageAward();//领取阶段性水滴奖励
} }
} else { await myCardInfoForFarm();
console.log('浇水出现失败异常,跳出不在继续浇水') const {
break; fastCard,
} doubleCard,
beanCard,
signCard
} = $.myCardInfoRes;
/* if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match(``) && beanCard > 0) {
console.log(`您设置的是使用水滴换豆卡,且背包有水滴换豆卡${beanCard}张, 跳过10次浇水任务`)
return
} */
if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
console.log(`\n准备浇水十次`);
let waterCount = 0;
isFruitFinished = false;
for (; waterCount < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit - $.farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
console.log(`${waterCount + 1}次浇水`);
await waterGoodForFarm();
console.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
if ($.waterResult.code === '0') {
console.log(`剩余水滴${$.waterResult.totalEnergy}g`);
if ($.waterResult.finished) {
// 已证实waterResult.finished为true表示水果可以去领取兑换了
isFruitFinished = true;
break
} else {
if ($.waterResult.totalEnergy < 10) {
console.log(`水滴不够,结束浇水`)
break
}
await gotStageAward(); //领取阶段性水滴奖励
}
} else {
console.log('浇水出现失败异常,跳出不在继续浇水')
break;
}
}
if (isFruitFinished) {
option['open-url'] = urlSchema;
$.msg($.name, ``, `【京东账号${$.index}${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去京东APP或微信小程序查看\n点击弹窗即达`, option);
$.done();
if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName || $.UserName}\n${$.farmInfo.farmUserPro.name}已可领取`);
}
if ($.isNode() && WP_APP_TOKEN_ONE) {
await notify.sendNotifybyWxPucher($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n【领取步骤】京东->我的->东东农场兑换京东红包,可以用于京东app的任意商品.`, `${$.UserName}`);
}
}
} else {
console.log('\n今日已完成10次浇水任务\n');
}
} catch (e) {
console.log(`doTenWater 任务执行异常‼️‼️`);
$.logErr(e);
} }
if (isFruitFinished) {
option['open-url'] = urlSchema;
$.msg($.name, ``, `【京东账号${$.index}${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去京东APP或微信小程序查看\n点击弹窗即达`, option);
$.done();
if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName || $.UserName}\n${$.farmInfo.farmUserPro.name}已可领取`);
}
}
} else {
console.log('\n今日已完成10次浇水任务\n');
}
} }
//领取首次浇水奖励 //领取首次浇水奖励
async function getFirstWaterAward() { async function getFirstWaterAward() {
@ -383,17 +473,22 @@ async function doTenWaterAgain() {
} }
if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match('限时翻倍')) { if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match('限时翻倍')) {
console.log(`\n您设置的是水滴换豆功能,现在为您换豆`); console.log(`\n您设置的是水滴换豆功能,现在为您换豆`);
if (totalEnergy >= 100 && $.myCardInfoRes.beanCard > 0) {
//使用水滴换豆卡 for (let lncount = 0; lncount < $.myCardInfoRes.beanCard; lncount++) {
await userMyCardForFarm('beanCard'); if (totalEnergy >= 150 && $.myCardInfoRes.beanCard > 0) {
console.log(`使用水滴换豆卡结果:${JSON.stringify($.userMyCardRes)}`); //使用水滴换豆卡
if ($.userMyCardRes.code === '0') { await userMyCardForFarm('beanCard');
message += `【水滴换豆卡】获得${$.userMyCardRes.beanCount}个京豆\n`; console.log(`使用水滴换豆卡结果:${JSON.stringify($.userMyCardRes)}`);
return if ($.userMyCardRes.code === '0') {
} totalEnergy=totalEnergy-100;
} else { message += `【水滴换豆卡】获得${$.userMyCardRes.beanCount}个京豆\n`;
console.log(`您目前水滴:${totalEnergy}g,水滴换豆卡${$.myCardInfoRes.beanCard}张,暂不满足水滴换豆的条件,为您继续浇水`) }
} } else {
console.log(`您目前水滴:${totalEnergy}g,水滴换豆卡${$.myCardInfoRes.beanCard}张,暂不满足水滴换豆的条件,为您继续浇水`)
break;
}
}
return;
} }
// if (totalEnergy > 100 && $.myCardInfoRes.fastCard > 0) { // if (totalEnergy > 100 && $.myCardInfoRes.fastCard > 0) {
// //使用快速浇水卡 // //使用快速浇水卡
@ -434,6 +529,9 @@ async function doTenWaterAgain() {
if ($.isNode()) { if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName || $.UserName}\n${$.farmInfo.farmUserPro.name}已可领取`); await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName || $.UserName}\n${$.farmInfo.farmUserPro.name}已可领取`);
} }
if ($.isNode() && WP_APP_TOKEN_ONE) {
await notify.sendNotifybyWxPucher($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n【领取步骤】京东->我的->东东农场兑换京东红包,可以用于京东app的任意商品.`, `${$.UserName}`);
}
} }
} else if (overageEnergy >= 10) { } else if (overageEnergy >= 10) {
console.log("目前剩余水滴:【" + totalEnergy + "】g可继续浇水"); console.log("目前剩余水滴:【" + totalEnergy + "】g可继续浇水");
@ -462,6 +560,9 @@ async function doTenWaterAgain() {
if ($.isNode()) { if ($.isNode()) {
await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName || $.UserName}\n${$.farmInfo.farmUserPro.name}已可领取`); await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName || $.UserName}\n${$.farmInfo.farmUserPro.name}已可领取`);
} }
if ($.isNode() && WP_APP_TOKEN_ONE) {
await notify.sendNotifybyWxPucher($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n【领取步骤】京东->我的->东东农场兑换京东红包,可以用于京东app的任意商品.`, `${$.UserName}`);
}
} }
} else { } else {
console.log("目前剩余水滴:【" + totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务") console.log("目前剩余水滴:【" + totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务")
@ -673,50 +774,52 @@ async function getExtraAward() {
} }
//助力好友 //助力好友
async function masterHelpShare() { async function masterHelpShare() {
console.log('开始助力好友')
await initForFarm(); await initForFarm();
let salveHelpAddWater = 0; let salveHelpAddWater = 0;
let remainTimes = 3;//今日剩余助力次数,默认3次京东农场每人每天3次助力机会 let remainTimes = 3;//今日剩余助力次数,默认3次京东农场每人每天3次助力机会
let helpSuccessPeoples = '';//成功助力好友 let helpSuccessPeoples = '';//成功助力好友
if(llhelp){
for (let code of newShareCodes) { console.log('开始助力好友')
console.log(`${$.UserName}开始助力: ${code}`); for (let code of newShareCodes) {
if (!code) continue; console.log(`${$.UserName}开始助力: ${code}`);
if (!$.farmInfo.farmUserPro) { if (!code) continue;
console.log('未种植,跳过助力\n') if (!$.farmInfo.farmUserPro) {
continue console.log('未种植,跳过助力\n')
} continue
if (code === $.farmInfo.farmUserPro.shareCode) { }
console.log('不能为自己助力哦跳过自己的shareCode\n') if (code === $.farmInfo.farmUserPro.shareCode) {
continue console.log('不能为自己助力哦跳过自己的shareCode\n')
} continue
await masterHelp(code); }
if ($.helpResult.code === '0') { await masterHelp(code);
if ($.helpResult.helpResult.code === '0') { if ($.helpResult.code === '0') {
//助力成功 if ($.helpResult.helpResult.code === '0') {
salveHelpAddWater += $.helpResult.helpResult.salveHelpAddWater; //助力成功
console.log(`【助力好友结果】: 已成功给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力`); salveHelpAddWater += $.helpResult.helpResult.salveHelpAddWater;
console.log(`给好友【${$.helpResult.helpResult.masterUserInfo.nickName}】助力获得${$.helpResult.helpResult.salveHelpAddWater}g水滴`) console.log(`【助力好友结果】: 已成功给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力`);
helpSuccessPeoples += ($.helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ','; console.log(`给好友【${$.helpResult.helpResult.masterUserInfo.nickName}】助力获得${$.helpResult.helpResult.salveHelpAddWater}g水滴`)
} else if ($.helpResult.helpResult.code === '8') { helpSuccessPeoples += ($.helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ',';
console.log(`【助力好友结果】: 助力【${$.helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`); } else if ($.helpResult.helpResult.code === '8') {
} else if ($.helpResult.helpResult.code === '9') { console.log(`【助力好友结果】: 助力【${$.helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`);
console.log(`【助力好友结果】: 之前给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力过了`); } else if ($.helpResult.helpResult.code === '9') {
} else if ($.helpResult.helpResult.code === '10') { console.log(`【助力好友结果】: 之前给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力过了`);
console.log(`【助力好友结果】: 好友【${$.helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`); } else if ($.helpResult.helpResult.code === '10') {
} else { console.log(`【助力好友结果】: 好友【${$.helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`);
console.log(`助力其他情况:${JSON.stringify($.helpResult.helpResult)}`); } else {
} console.log(`助力其他情况:${JSON.stringify($.helpResult.helpResult)}`);
console.log(`【今日助力次数还剩】${$.helpResult.helpResult.remainTimes}\n`); }
remainTimes = $.helpResult.helpResult.remainTimes; console.log(`【今日助力次数还剩】${$.helpResult.helpResult.remainTimes}\n`);
if ($.helpResult.helpResult.remainTimes === 0) { remainTimes = $.helpResult.helpResult.remainTimes;
console.log(`您当前助力次数已耗尽,跳出助力`); if ($.helpResult.helpResult.remainTimes === 0) {
break console.log(`您当前助力次数已耗尽,跳出助力`);
} break
} else { }
console.log(`助力失败::${JSON.stringify($.helpResult)}`); } else {
} console.log(`助力失败::${JSON.stringify($.helpResult)}`);
} }
}
}
if ($.isLoon() || $.isQuanX() || $.isSurge()) { if ($.isLoon() || $.isQuanX() || $.isSurge()) {
let helpSuccessPeoplesKey = timeFormat() + $.farmInfo.farmUserPro.shareCode; let helpSuccessPeoplesKey = timeFormat() + $.farmInfo.farmUserPro.shareCode;
if (!$.getdata(helpSuccessPeoplesKey)) { if (!$.getdata(helpSuccessPeoplesKey)) {
@ -741,7 +844,6 @@ async function masterHelpShare() {
console.log(`【助力好友👬】获得${salveHelpAddWater}g💧\n`); console.log(`【助力好友👬】获得${salveHelpAddWater}g💧\n`);
} }
message += `【今日剩余助力👬】${remainTimes}\n`; message += `【今日剩余助力👬】${remainTimes}\n`;
console.log('助力好友结束,即将开始领取额外水滴奖励\n');
} }
//水滴雨 //水滴雨
async function executeWaterRains() { async function executeWaterRains() {
@ -753,7 +855,7 @@ async function executeWaterRains() {
if (Date.now() < ($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) { if (Date.now() < ($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) {
executeWaterRain = false; executeWaterRain = false;
// message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`; // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`;
console.log(`\`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`); console.log(`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`);
} }
} }
if (executeWaterRain) { if (executeWaterRain) {
@ -996,18 +1098,44 @@ async function duck() {
} }
} }
async function GetCollect() { async function GetCollect() {
try { try {
await initForFarm(); console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】`);
if ($.farmInfo.farmUserPro) { var llfound = false;
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】${$.farmInfo.farmUserPro.shareCode}`); var strShareCode = "";
newShareCodes.push($.farmInfo.farmUserPro.shareCode) if (TempShareCache) {
} else { for (let j = 0; j < TempShareCache.length; j++) {
console.log(`\n【京东账号${$.index}${$.UserName})的${$.name}好友互助码】\n数据异常,使用ccwav的互助码:f910ae66879a422daeb32f9250fc5e2e`); if (TempShareCache[j].pt_pin == $.UserName) {
newShareCodes.push("f910ae66879a422daeb32f9250fc5e2e"); llfound = true;
strShareCode = TempShareCache[j].ShareCode;
}
}
}
if (!llfound) {
console.log($.UserName + "该账号无缓存,尝试联网获取互助码.....");
llgetshare=true;
await initForFarm();
if ($.farmInfo.farmUserPro) {
var tempAddCK = {};
strShareCode=$.farmInfo.farmUserPro.shareCode;
tempAddCK = {
"pt_pin": $.UserName,
"ShareCode": strShareCode
};
TempShareCache.push(tempAddCK);
//标识,需要更新缓存文件
boolneedUpdate = true;
}
}
if (strShareCode) {
console.log(`\n`+strShareCode);
newShareCodes.push(strShareCode)
} else {
console.log(`\n数据异常`);
}
} catch (e) {
$.logErr(e);
} }
} catch (e) {
$.logErr(e);
}
} }
// ========================API调用接口======================== // ========================API调用接口========================
//鸭子,点我有惊喜 //鸭子,点我有惊喜
@ -1017,7 +1145,7 @@ async function getFullCollectionReward() {
$.post(taskUrl("getFullCollectionReward", body), (err, resp, data) => { $.post(taskUrl("getFullCollectionReward", body), (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log('\n东东农场: API查询请求失败 ‼️‼️'); console.log('\ngetFullCollectionReward: API查询请求失败 ‼️‼️');
console.log(JSON.stringify(err)); console.log(JSON.stringify(err));
$.logErr(err); $.logErr(err);
} else { } else {
@ -1071,8 +1199,8 @@ async function gotStageAwardForFarm(type) {
} }
//浇水API //浇水API
async function waterGoodForFarm() { async function waterGoodForFarm() {
await $.wait(1000); await $.wait(2000);
console.log('等待了1秒'); console.log('等待了2秒');
const functionId = arguments.callee.name.toString(); const functionId = arguments.callee.name.toString();
$.waterResult = await request(functionId); $.waterResult = await request(functionId);
@ -1082,8 +1210,8 @@ async function initForTurntableFarm() {
$.initForTurntableFarmRes = await request(arguments.callee.name.toString(), { version: 4, channel: 1 }); $.initForTurntableFarmRes = await request(arguments.callee.name.toString(), { version: 4, channel: 1 });
} }
async function lotteryForTurntableFarm() { async function lotteryForTurntableFarm() {
await $.wait(2000); await $.wait(3000);
console.log('等待了2秒'); console.log('等待了3秒');
$.lotteryRes = await request(arguments.callee.name.toString(), { type: 1, version: 4, channel: 1 }); $.lotteryRes = await request(arguments.callee.name.toString(), { type: 1, version: 4, channel: 1 });
} }
@ -1267,7 +1395,7 @@ async function initForFarm() {
$.post(option, (err, resp, data) => { $.post(option, (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log('\n东东农场: API查询请求失败 ‼️‼️'); console.log('\ninitForFarm: API查询请求失败 ‼️‼️');
console.log(JSON.stringify(err)); console.log(JSON.stringify(err));
$.logErr(err); $.logErr(err);
} else { } else {
@ -1402,7 +1530,7 @@ function request(function_id, body = {}, timeout = 1000) {
$.get(taskUrl(function_id, body), (err, resp, data) => { $.get(taskUrl(function_id, body), (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log('\n东东农场: API查询请求失败 ‼️‼️') console.log('\nrequest: API查询请求失败 ‼️‼️')
console.log(JSON.stringify(err)); console.log(JSON.stringify(err));
console.log(`function_id:${function_id}`) console.log(`function_id:${function_id}`)
$.logErr(err); $.logErr(err);