KR/jd_fruit_task.js

45 lines
179 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-08-25 11:05:55 +08:00
默认浇水,不浇水设置变量export jd_fruit_Water='true'
export DO_TEN_WATER_AGAIN="" 默认再次浇水
2023-08-25 23:03:50 +08:00
需要关闭通知 在第39行 false 改成 true
2023-07-27 16:14:01 +08:00
*/
const $ = new Env('东东农场日常任务');
2023-08-25 23:03:50 +08:00
let cookiesArr = [],
cookie = '',
jdFruitShareArr = [],
isBox = false,
notify,
newShareCodes,
allMessage = '';
let shareCodes = [];
let message = '',
subTitle = '',
option = {},
isFruitFinished = false;
const retainWater = $.isNode() ? (process.env.retainWater ? process.env.retainWater : 100) : $.getdata('retainWater') ? $.getdata('retainWater') : 100; //保留水滴大于多少g,默认100g;
let jdNotify = false; //是否关闭通知false打开通知推送true关闭通知推送
let jdFruitBeanCard = false; //农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
let randomCount = $.isNode() ? 20 : 5;
2023-08-26 19:52:40 +08:00
var version_='jsjiami.com.v7';const IIiIi1Ii=lIl11Iil;(function(lii1il1l,i1IIlI,liiIlIlI,I1Iii1Il,lIlIIliI,lIil1l1i,i1lilI1l){return lii1il1l=lii1il1l>>0x6,lIil1l1i='hs',i1lilI1l='hs',function(I1Iliil,lIIIIlIi,i1lilll,IiIIiIil,l1Ili1II){const iI1iIili=lIl11Iil;IiIIiIil='tfi',lIil1l1i=IiIIiIil+lIil1l1i,l1Ili1II='up',i1lilI1l+=l1Ili1II,lIil1l1i=i1lilll(lIil1l1i),i1lilI1l=i1lilll(i1lilI1l),i1lilll=0x0;const ll1I1Iil=I1Iliil();while(!![]&&--I1Iii1Il+lIIIIlIi){try{IiIIiIil=parseInt(iI1iIili(0x6c5,'ua7O'))/0x1*(parseInt(iI1iIili(0x47c,'O3*p'))/0x2)+-parseInt(iI1iIili(0x1d9,'3hlZ'))/0x3*(parseInt(iI1iIili(0x23f,'zy8Z'))/0x4)+-parseInt(iI1iIili(0x60a,'ZyMa'))/0x5*(parseInt(iI1iIili(0x592,'VTkw'))/0x6)+-parseInt(iI1iIili(0x5ae,'1p)h'))/0x7*(parseInt(iI1iIili(0x295,'1^)X'))/0x8)+parseInt(iI1iIili(0x62b,'*y^a'))/0x9+parseInt(iI1iIili(0x2d4,'crd2'))/0xa*(parseInt(iI1iIili(0x50a,'TT4j'))/0xb)+parseInt(iI1iIili(0x7b1,'TO*k'))/0xc;}catch(lIlli1l1){IiIIiIil=i1lilll;}finally{l1Ili1II=ll1I1Iil[lIil1l1i]();if(lii1il1l<=I1Iii1Il)i1lilll?lIlIIliI?IiIIiIil=l1Ili1II:lIlIIliI=l1Ili1II:i1lilll=l1Ili1II;else{if(i1lilll==lIlIIliI['replace'](/[DTXnuGUOwEpbWfrVN=]/g,'')){if(IiIIiIil===lIIIIlIi){ll1I1Iil['un'+lIil1l1i](l1Ili1II);break;}ll1I1Iil[i1lilI1l](l1Ili1II);}}}}}(liiIlIlI,i1IIlI,function(I1iliIll,liiiIlli,iIII1iI1,lii1Ii1I,IililiI1,II1IiIli,ll1I11Il){return liiiIlli='\x73\x70\x6c\x69\x74',I1iliIll=arguments[0x0],I1iliIll=I1iliIll[liiiIlli](''),iIII1iI1=`\x72\x65\x76\x65\x72\x73\x65`,I1iliIll=I1iliIll[iIII1iI1]('\x76'),lii1Ii1I=`\x6a\x6f\x69\x6e`,(0x13b42b,I1iliIll[lii1Ii1I](''));});}(0x30c0,0x3fccb,iIl1iiiI,0xc5),iIl1iiiI)&&(version_=iIl1iiiI);let i1IIii1=process['env'][IIiIi1Ii(0x11a,'4us@')]===IIiIi1Ii(0x22b,'HMGO')?!![]:![];const i1i1ilI1=IIiIi1Ii(0x5b8,'(!zH'),ilIilli=IIiIi1Ii(0xf7,'3%1w'),ili1ill1=require(IIiIi1Ii(0x476,'ps@a')),i1llIl1I=require(IIiIi1Ii(0x252,'j2&m')),iiil11iI=require(IIiIi1Ii(0x4d6,'VTkw'));let i1lIli1=I1I1l1(0x28),I1Illi11=I1I1l1(0xa,IIiIi1Ii(0x98,'(m6)')),Iillliii=I1I1l1(0x20,IIiIi1Ii(0x4eb,'Jx*&')),Ili1I1ll=I1I1l1(0x2,'1234567890')+'-'+I1I1l1(0x4,IIiIi1Ii(0x2f9,'19R&'))+'-'+I1I1l1(0x4,IIiIi1Ii(0x6d2,'rVY7'))+'-'+I1I1l1(0x5,IIiIi1Ii(0x454,'1&&6')),ll1I11iI=IIiIi1Ii(0x75d,'ZyMa')+Math[IIiIi1Ii(0x3b6,'1&&6')](Math['random']()*0x383+0x64),iiIIilii=IIiIi1Ii(0x5e9,'(!zH')+Math[IIiIi1Ii(0x5b3,'RI&Z')](Math[IIiIi1Ii(0x408,'(!zH')]()*0x383+0x64),IiiliiIi='',liilll1=0x0;!(async()=>{const iilI11il=IIiIi1Ii,IIliI1I={'uJaky':function(liI1IlIi,iiliIiIi){return liI1IlIi+iiliIiIi;},'urdrE':function(IIi1lIl,i1i1illl){return IIi1lIl+i1i1illl;},'dNYHK':function(IiIl11I1,ilIIIII){return IiIl11I1>=ilIIIII;},'LZHpP':function(Il1liil,IliiIIi1){return Il1liil+IliiIIi1;},'XFwkL':function(liiilllI,IililI1l){return liiilllI+IililI1l;},'oOZAN':function(iilIlIli){return iilIlIli();},'ZYCrg':iilI11il(0x52c,'bBcI'),'WpFcM':iilI11il(0x17e,'nC)u'),'iqbJF':function(iI1Il1II,l1liiiII){return iI1Il1II<l1liiiII;},'URqBf':function(II11liII,i11l11li){return II11liII===i11l11li;},'HVyxy':'OncSY','wQyCZ':iilI11il(0x374,'^Zn8'),'tUfRK':function(IIil1ll1,ill1111l){return IIil1ll1(ill1111l);},'alWeO':iilI11il(0x230,'(*K@'),'OduBn':'XJEAt','MVPXk':function(il11il1l,IiII111){return il11il1l*IiII111;}};await IIliI1I['oOZAN'](iiIl11iI);if(!cookiesArr[0x0]){$[iilI11il(0x443,'3hlZ')]($[iilI11il(0x2bb,'^Zn8')],IIliI1I[iilI11il(0x45f,'o7B6')],iilI11il(0x7ae,'3%1w'),{'open-url':IIliI1I[iilI11il(0x5d2,'rVY7')]});return;}console[iilI11il(0x458,'ps@a')](iilI11il(0x5d9,'ps@a'));for(let lIlilI=0x0;IIliI1I['iqbJF'](lIlilI,cookiesArr['length']);lIlilI++){if(cookiesArr[lIlilI]){if(IIliI1I[iilI11il(0x4ea,'iEE6')](IIliI1I[iilI11il(0x552,'I@IC')],IIliI1I['wQyCZ'])){let il1IIl1I;return lilI11i?il1IIl1I=new lI1I1Iii(Il1i1I11):il1IIl1I=new ii1IiIl(),IIliI1I['uJaky'](IIliI1I['urdrE'](IIliI1I['urdrE'](il1IIl1I[iilI11il(0x38d,'iEE6')](),'-'),IIliI1I[iilI11il(0x34a,'K$D3')](IIliI1I[iilI11il(0x2e2,'CLxQ')](il1IIl1I['getMonth'](),0x1),0xa)?IIliI1I[iilI11il(0x1dc,'j2&m')](il1IIl1I[iilI11il(0x346,'iEE6')](),0x1):IIliI1I[iilI11il(0x5f9,'Jx*&')]('0',IIliI1I[iilI11il(0x62d,'TT4j')](il1IIl1I[i
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