KR/jd_fruit_task.js

43 lines
151 KiB
JavaScript
Raw Normal View History

2023-07-27 16:14:01 +08:00
/*
东东水果:脚本更新地址 jd_fruit_task.js
更新时间2021-5-18
活动入口京东APP我的-更多工具-东东农场
==========================Quantumultx=========================
[task_local]
2023-08-25 03:43:26 +08:00
#东东农场日常任务
2023-07-27 16:14:01 +08:00
5 6-18/6 * * * jd_fruit_task.js, tag=东东农场日常任务, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
=========================Loon=============================
[Script]
cron "5 6-18/6 * * *" script-path=jd_fruit_task.js,tag=东东农场日常任务
=========================Surge============================
东东农场日常任务 = type=cron,cronexp="5 6-18/6 * * *",wake-system=1,timeout=3600,script-path=jd_fruit_task.js
=========================小火箭===========================
东东农场日常任务 = type=cron,script-path=jd_fruit_task.js, cronexpr="5 6-18/6 * * *", timeout=3600, enable=true
2023-10-31 01:41:38 +08:00
默认浇水,不浇水设置变量 export jd_fruit_Water="true"
默认在完成每日任务后再次浇水若保留水滴请设置变量 export DO_TEN_WATER_AGAIN="false"
2023-08-25 23:03:50 +08:00
2023-07-27 16:14:01 +08:00
*/
2023-10-31 01:41:38 +08:00
const $ = new Env('东东农场日常任务')
2023-08-25 23:03:50 +08:00
let cookiesArr = [],
cookie = '',
jdFruitShareArr = [],
isBox = false,
notify,
newShareCodes,
2023-10-31 01:41:38 +08:00
allMessage = ''
let shareCodes = []
2023-08-25 23:03:50 +08:00
let message = '',
subTitle = '',
option = {},
2023-10-31 01:41:38 +08:00
isFruitFinished = false
const retainWater = $.isNode() ? (process.env.retainWater ? process.env.retainWater : 100) : $.getdata('retainWater') ? $.getdata('retainWater') : 100 //保留水滴大于多少g,默认100g;
let jdNotify = true //是否关闭通知false打开通知推送true关闭通知推送
let jdFruitBeanCard = false //农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
let randomCount = $.isNode() ? 20 : 5
2023-10-31 14:32:57 +08:00
var version_='jsjiami.com.v7';const lIiiil=iii1II;(function(I1ili,iilil1,il1lll,i1Il11,li1lI1,ll1I11,l1lli){return I1ili=I1ili>>0x8,ll1I11='hs',l1lli='hs',function(il1lli,IIi1Il,l1lll,IIi1Ii,li1lII){const i1Il1I=iii1II;IIi1Ii='tfi',ll1I11=IIi1Ii+ll1I11,li1lII='up',l1lli+=li1lII,ll1I11=l1lll(ll1I11),l1lli=l1lll(l1lli),l1lll=0x0;const Il11II=il1lli();while(!![]&&--i1Il11+IIi1Il){try{IIi1Ii=-parseInt(i1Il1I(0x760,'4PM&'))/0x1*(parseInt(i1Il1I(0x40a,'[XWN'))/0x2)+-parseInt(i1Il1I(0x28e,'CN2r'))/0x3+-parseInt(i1Il1I(0x2a2,'3&m6'))/0x4*(-parseInt(i1Il1I(0xce,'Ei$a'))/0x5)+-parseInt(i1Il1I(0x2e5,'4Yt%'))/0x6*(-parseInt(i1Il1I(0x122,'$9Wh'))/0x7)+-parseInt(i1Il1I(0x69d,'1kgB'))/0x8*(parseInt(i1Il1I(0x44f,'xhx0'))/0x9)+parseInt(i1Il1I(0x2ed,'41aF'))/0xa*(parseInt(i1Il1I(0x410,'urIT'))/0xb)+parseInt(i1Il1I(0x441,'ocj)'))/0xc*(parseInt(i1Il1I(0x4b7,'UEFS'))/0xd);}catch(Iilll){IIi1Ii=l1lll;}finally{li1lII=Il11II[ll1I11]();if(I1ili<=i1Il11)l1lll?li1lI1?IIi1Ii=li1lII:li1lI1=li1lII:l1lll=li1lII;else{if(l1lll==li1lI1['replace'](/[GMFJlKBUqRwWSxEeTgnHP=]/g,'')){if(IIi1Ii===IIi1Il){Il11II['un'+ll1I11](li1lII);break;}Il11II[l1lli](li1lII);}}}}}(il1lll,iilil1,function(I11Ill,IlII1l,IiIIll,lIiiii,iililI,IlII1i,Iilli){return IlII1l='\x73\x70\x6c\x69\x74',I11Ill=arguments[0x0],I11Ill=I11Ill[IlII1l](''),IiIIll=`\x72\x65\x76\x65\x72\x73\x65`,I11Ill=I11Ill[IiIIll]('\x76'),lIiiii=`\x6a\x6f\x69\x6e`,(0x14535c,I11Ill[lIiiii](''));});}(0xc700,0x8281a,Iii11l,0xc9),Iii11l)&&(version_=lIiiil(0x381,'Fs8Z'));function Iii11l(){const IIiliI=(function(){return[...[version_,'GMSjHTsWPjiJFagJmliqw.KecWoEUmnKx.HMvB7R==','jFglOPu','kSocgWtcUWusiSoewmoNW5PwWPRcJCkaW4tORzlMS6VLP7/OTBpVV43ORkpMOBdMNl/NV4NOTjhPHPZORAK','B8kRW5q+WQG','WRK1WPVdG1/dGW','Amo5kqdcKW','wmo8WRK','W5enW4vjWPL3','WPSHWOziWOddNq','Bg3dHG','nSk2y3BdPW','gmkJACo8qa','57Uo5AsJ5yYF5REP5Rgx55Q7','yCkcmbZcMq','WPu2WODyWOFdKmodW6G9W7NdRYL1WOvOW4Sd','5BEg5A2h5OIL566M','6kYo5yUS6zIW5OEU5z2Xj8kyWOz0WQBOVBNLHRFMOAtKVAtMLPBLHk/LR4Dj5BUa6k6m6yg+6l+u6isY5P+p5y6J6i+15y6FW5ZcH2pdIXPf','a8o4aCk7AICVdCkLWPFcMLG','tM7dImopWOK','WPH3W5VcPdCaWOxcMuC','luldUCoUcvqiWPug','W7eLc8kSWQC','dCkykSkP','5BAA57MJ6Ac35yYk6l+iW53LPARLJ7FLI5JLIzhPOPhLPyJLP7pLIBq','WROIEmoW','dmkUWPDvq8kRW7C','zSopgq','WPNdOmkXx8kaW5pcHCozrINdLmk5ocOWWRnNWOGaCWRcICkorCo5FGu','W7nRWO3cJCkgWODOosS','WO3cT8o8WQq','E3HibCkK','iCk/xwxdNr9JkSkaf8oYlSkaFvpcHbK','44oa5A6c5PE26AkR5RgF44k26i+a5B21','r8knCmkbWPO','5Ro+5RUp5lIc5AA1772z57MB5P+g5RsA5Ro0','W6/cGuVdHMORu8kMtCoynmoemCk7BwpcKIG','WQ84W5JdP2xcH8ojCHBcLmkgoqdcKq7cVcGHW4G','W4aOW6ZdGSkCW6uVf0pcHq','W7hcHmoOWROBkmkTyG','W4GLcSkCWPO','WOlcT8oSWRusnIjZWPKP','WOKEW7GLWOBcJKmo','5Q6B5RAH5Rka','WP3dPmoOfKW','uSo6WQW5W5JcLhOBpwpdPHqtW5C','D8ksW7ijrSoOW6dcG8kJW5JcTq','WP/cPmoYWQdcHa','W5mjW4zl','W7jpWO3cVSkI','WQqQkCkjWOhdT8koWQi/ufDrbSkbvGRcLEIVGoAZI+wLVoI1Po+/GoITIoAJOUAEP+E9R+I2K+MfNoITJG','W6iPpSkfWQBdJCkjWR4','WQtcIg/dTCo5','htFdKgy4EtKJz8ouW6BcVSkGW6/dIs4','6iYO5B2657Ms5AAS5y6E5Rso5Ro05Awr5yQR','WQDctCoYbG','uSkHsvhcPG','WONcVCoSWQuwmdO','44kN6Akc5AAm5AAJ5yIn44cV6Ag85yY05OQh5yUo77+m6iY35B63','5Bg/6BM75A+Z5RIQ5OMsmq','44cK5Ro/5RUb5O+O6lcz5y2044gp6i+c5B2D','a8opWOPJWR4','5B2F6ygf5REo5Rkt5y64WQC','zSkHDxdcJW','W5RcM3/dV2e','W7jTWQVcTmkb','WOVdOZq','WQLIBSoheq','5A6O5PsC6Ake5Ro85OUp5yMK57Iv5P+oW6tdUuq','W47cJ8oItZC','WOOwW6S','c8kfk8k7WPpcKSkvAulcR8kZW402WRpcVSk2wMeICx84WOSzWRVcHfq','WQrXv0Kj','vvGSWO0n','pSk4WOzLAmkRW7rz','44cb5OYJ56A644g1Cmo0W6RcMSkAW4/LTkJLPPxML58','ovpdV8obeL8nWQOAvHO','FNDJog0','WOhdV8kSWPO0fh5L','ruZdJCo0WQq','c8odW5xcUq','BvnGo8o7WR8gWQTJwmkADXJcIgNcPmkiW6DsxSkOu0hdUdFcHua5WQ3cJCoRWP42iCopmHa3nHldLulcKhFcSJSYW4RcTrZcSb0BWOpdTsC/W6DvW54iW5ddVSoPWRpcU2pcPCk7WR9eWQKZrSkSFrfGm8k3mLtcTWlcOSoanCk0wmkHWRZcHmoMWPxcM8oXW40rW7NcV8oJWO/dLYFdUSo/W6lcHxZcLLfYWRFdGG1amMldJ8kdWP/cKbddUMvxuCoCW5ndhCkuemo4WRtdM8k1aH7dS0LvWQxdPdBdThGfWPWvWOrYWRxdSLqpWPOSoLxdRCkVW6aDrbCnk2FdVNNdP8k+jWdcKg8xia3dQ8kPjx4Ul0BcPbD0WO/dHrZcPfTBCv3dQwddJ8koEmo3wwVcTmkCWObaCCoaW6/cLM/dLSo0asP+ceP8kgldICkGm2r4jtRcK1ixWQOnWOKpW5OeW4eOotjfwbFdQ8o0ywtdQmo1WQCNWPNdOqhcGSklrwOuf2CdiayrnuSHWRNdG0ZdNCoGWQm4ESkGWQnhWPi+W6JcMJxdHaF
2023-07-27 16:14:01 +08:00
// prettier-ignore
2023-08-25 03:43:26 +08:00
function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.d