Merge pull request #165 from FanchangWang/master

[京喜农场] 已成熟时跳过任务&助力&助力时间间隔加长
This commit is contained in:
LXK9301
2021-01-21 18:14:44 +08:00
committed by GitHub

View File

@@ -38,7 +38,7 @@ cron "0 9,12,18 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_
const $ = new Env('京喜农场'); const $ = new Env('京喜农场');
let notify = ''; // nodejs 发送通知脚本 let notify = ''; // nodejs 发送通知脚本
let notifyLevel = $.isNode() ? process.env.JXNC_NOTIFY_LEVEL || 3 : 3; // 通知级别 0=通知;1=本次获得水滴>0;2=任务执行;3=任务执行+未种植种子; let notifyLevel = $.isNode() ? process.env.JXNC_NOTIFY_LEVEL || 3 : 3; // 通知级别 0=通知成熟;1=本次获得水滴>0;2=任务执行;3=任务执行+未种植种子;
let notifyBool = true; // 代码内部使用,控制是否通知 let notifyBool = true; // 代码内部使用,控制是否通知
let cookieArr = []; // 用户 cookie 数组 let cookieArr = []; // 用户 cookie 数组
let currentCookie = ''; // 当前用户 cookie let currentCookie = ''; // 当前用户 cookie
@@ -227,36 +227,39 @@ async function jdJXNC() {
subTitle = `【京东账号${$.index}${$.nickName}`; subTitle = `【京东账号${$.index}${$.nickName}`;
$.log(`获取用户信息 & 任务列表`); $.log(`获取用户信息 & 任务列表`);
const startInfo = await getTaskList(); const startInfo = await getTaskList();
if (startInfo.prizename) {
message += `【水果名称】${startInfo.prizename}\n`;
}
if (startInfo) { if (startInfo) {
$.log(`【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】 ${$.info.smp}`); message += `【水果名称】${startInfo.prizename}\n`;
$.log(`【京东账号${$.index}${$.nickName || $.UserName})的${$.name}种子active】 ${$.info.active}`); if (startInfo.target <= startInfo.score) {
await $.wait(500); notifyBool = true;
const isOk = await browserTask(); message += `【成熟】水果已成熟请及时收取deliverState${startInfo.deliverState}\n`;
if (isOk) { } else {
$.log(`【京东账号${$.index}${$.nickName || $.UserName})的${$.name}好友互助码】 ${$.info.smp}`);
$.log(`【京东账号${$.index}${$.nickName || $.UserName})的${$.name}种子active】 ${$.info.active}`);
await $.wait(500); await $.wait(500);
await answerTask(); const isOk = await browserTask();
await $.wait(500); if (isOk) {
const endInfo = await getTaskList(); await $.wait(500);
getMessage(endInfo, startInfo); await answerTask();
await submitInviteId($.UserName); await $.wait(500);
await $.wait(500); const endInfo = await getTaskList();
let next = await helpFriends(); getMessage(endInfo, startInfo);
if (next) { await submitInviteId($.UserName);
while ($.helpNum < $.maxHelpNum) { await $.wait(500);
$.helpNum++; let next = await helpFriends();
assistUserShareCode = await getAssistUser(); if (next) {
if (assistUserShareCode) { while ($.helpNum < $.maxHelpNum) {
await $.wait(300); $.helpNum++;
next = await helpShareCode(assistUserShareCode); assistUserShareCode = await getAssistUser();
if (next) { if (assistUserShareCode) {
await $.wait(200); await $.wait(500);
continue; next = await helpShareCode(assistUserShareCode);
if (next) {
await $.wait(1000);
continue;
}
} }
break;
} }
break;
} }
} }
} }
@@ -356,7 +359,9 @@ function answerTask() {
if (ret === 0 && right === 1) { if (ret === 0 && right === 1) {
$.drip += eachtimeget; $.drip += eachtimeget;
} }
if (ret === 1017) { // ret:1017 retmsg:"score full" 水滴已满,果实成熟,跳过答题 // ret:1017 retmsg:"score full" 水滴已满,果实成熟,跳过答题
// ret:1012 retmsg:"has complte" 已完成,跳过答题
if (ret === 1017 || ret === 1012) {
resolve(); resolve();
return; return;
} }
@@ -391,7 +396,7 @@ function getMessage(endInfo, startInfo) {
message += `【水滴】本次获得${get} 离线获得${leaveGet} 今日获得${dayGet} 还需水滴${need}\n`; message += `【水滴】本次获得${get} 离线获得${leaveGet} 今日获得${dayGet} 还需水滴${need}\n`;
if (need <= 0) { if (need <= 0) {
notifyBool = true; notifyBool = true;
message += `【成熟】水果已成熟请及时收取\n`; message += `【成熟】水果已成熟请及时收取deliverState${endInfo.deliverState}\n`;
return; return;
} }
if (get > 0 || leaveGet > 0 || dayGet > 0) { if (get > 0 || leaveGet > 0 || dayGet > 0) {
@@ -476,6 +481,7 @@ async function helpFriends() {
if (!next) { if (!next) {
return false; return false;
} }
await $.wait(1000);
} }
return true; return true;
} }