From b04c4342c0ab8119a28f5c1a1e2e1c02bfe4e7f6 Mon Sep 17 00:00:00 2001 From: Faker Date: Fri, 18 Mar 2022 10:44:15 +0800 Subject: [PATCH] sync --- jd_plantBean.js => jd_plantBean_Mod.js | 63 +++++++++++++++++--------- 1 file changed, 42 insertions(+), 21 deletions(-) rename jd_plantBean.js => jd_plantBean_Mod.js (97%) diff --git a/jd_plantBean.js b/jd_plantBean_Mod.js similarity index 97% rename from jd_plantBean.js rename to jd_plantBean_Mod.js index 4151eed..31517cc 100644 --- a/jd_plantBean.js +++ b/jd_plantBean_Mod.js @@ -25,7 +25,7 @@ cron "1 7-21/2 * * *" script-path=https://raw.githubusercontent.com/Aaron-lv/syn 京东种豆得豆 = 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; //ios等软件用户直接用NobyDa的jd cookie let jdNotify = true;//是否开启静默运行。默认true开启 @@ -44,6 +44,20 @@ let awardState = '';//上期活动的京豆是否收取 let randomCount = $.isNode() ? 20 : 5; let num; $.newShareCode = []; + +let NowHour = new Date().getHours(); +let llhelp=true; +if ($.isNode() && process.env.CC_NOHELPAFTER8) { + console.log(NowHour); + if (process.env.CC_NOHELPAFTER8=="true"){ + if (NowHour>8){ + llhelp=false; + console.log(`现在是9点后时段,不启用互助....`); + } + } +} + + !(async () => { await requireConfig(); if (!cookiesArr[0]) { @@ -74,15 +88,17 @@ $.newShareCode = []; await showMsg(); } } - for (let j = 0; j < cookiesArr.length; j++) { - if (cookiesArr[j]) { - cookie = cookiesArr[j]; - $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) - $.index = j + 1; - //await shareCodesFormat(); - await doHelp() - } - } + if(llhelp){ + for (let j = 0; j < cookiesArr.length; j++) { + if (cookiesArr[j]) { + cookie = cookiesArr[j]; + $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) + $.index = j + 1; + //await shareCodesFormat(); + await doHelp() + } + } + } if ($.isNode() && allMessage) { await notify.sendNotify(`${$.name}`, `${allMessage}`) } @@ -269,18 +285,23 @@ async function doTask() { } await shopTaskList(); const { data } = $.shopTaskListRes; - let goodShopListARR = [], moreShopListARR = [], shopList = []; + let goodShopListARR = [],moreShopListARR = [], shopList = []; const { goodShopList, moreShopList } = data; - for (let i of goodShopList) { - if (i.taskState === '2') { - goodShopListARR.push(i); - } - } - for (let j of moreShopList) { - if (j.taskState === '2') { - moreShopListARR.push(j); - } - } + if (goodShopList) { + for (let i of goodShopList) { + if (i.taskState === '2') { + goodShopListARR.push(i); + } + } + } + if (moreShopList) { + for (let j of moreShopList) { + if (j.taskState === '2') { + moreShopListARR.push(j); + } + } + } + shopList = goodShopListARR.concat(moreShopListARR); for (let shop of shopList) { const { shopId, shopTaskId } = shop;