KR/jd_fruit_watering.js

20 lines
54 KiB
JavaScript
Raw Permalink Normal View History

2023-07-27 16:14:01 +08:00
/*
东东农场快速浇水
2023-10-26 16:51:26 +08:00
环境变量FRUIT_PLANT_LEVEL // 自动种植的作物等级正整数默认为2
FRUIT_WATERING_NOTIFY // 是否推送通知true/false默认不推送
每月或每周只能领2次红包由于常规浇水太慢脚本优先使用快速浇水卡
2023-07-27 16:14:01 +08:00
*/
2023-10-26 16:51:26 +08:00
const $ = new Env('东东农场快速浇水')
2023-10-30 20:50:03 +08:00
const jdCookie = require('./jdCookie')
const notify = require('./function/sendJDNotify')
2023-10-30 20:50:47 +08:00
const H5st = require('./function/krgetH5st')
2023-10-30 20:50:03 +08:00
const common = require('./function/jdCommon')
2023-10-30 21:15:40 +08:00
var version_='jsjiami.com.v7';const lIi1iIl=lIlllI11;(function(il1lI1il,IlI1il,i1iilIIi,ii111lII,iiIi1li,lii1Ili,I1I1lIi1){return il1lI1il=il1lI1il>>0x5,lii1Ili='hs',I1I1lIi1='hs',function(iIll1iI1,lIiIilI1,llii1,IiiiilI,ii1iIlI1){const iiIIli1l=lIlllI11;IiiiilI='tfi',lii1Ili=IiiiilI+lii1Ili,ii1iIlI1='up',I1I1lIi1+=ii1iIlI1,lii1Ili=llii1(lii1Ili),I1I1lIi1=llii1(I1I1lIi1),llii1=0x0;const liIi1=iIll1iI1();while(!![]&&--ii111lII+lIiIilI1){try{IiiiilI=parseInt(iiIIli1l(0x187,'2yaQ'))/0x1+-parseInt(iiIIli1l(0x269,'b@AP'))/0x2*(parseInt(iiIIli1l(0x21a,'BI1K'))/0x3)+-parseInt(iiIIli1l(0x257,'2Kgu'))/0x4*(parseInt(iiIIli1l(0x29d,'R$MT'))/0x5)+-parseInt(iiIIli1l(0x278,'uSyT'))/0x6+parseInt(iiIIli1l(0x24a,'yS@Y'))/0x7*(-parseInt(iiIIli1l(0x1fa,'cVa&'))/0x8)+-parseInt(iiIIli1l(0x23f,'5bz1'))/0x9+parseInt(iiIIli1l(0x292,'ovfz'))/0xa*(parseInt(iiIIli1l(0x194,'*8K]'))/0xb);}catch(Iii11){IiiiilI=llii1;}finally{ii1iIlI1=liIi1[lii1Ili]();if(il1lI1il<=ii111lII)llii1?iiIi1li?IiiiilI=ii1iIlI1:iiIi1li=ii1iIlI1:llii1=ii1iIlI1;else{if(llii1==iiIi1li['replace'](/[YIuwPpnGKCxNTVJOkFQW=]/g,'')){if(IiiiilI===lIiIilI1){liIi1['un'+lii1Ili](ii1iIlI1);break;}liIi1[I1I1lIi1](ii1iIlI1);}}}}}(i1iilIIi,IlI1il,function(lli1III1,liI1i1,iliIlI1i,IiI11lIi,I11iI1il,IiIlIIlI,ll1i1Ii1){return liI1i1='\x73\x70\x6c\x69\x74',lli1III1=arguments[0x0],lli1III1=lli1III1[liI1i1](''),iliIlI1i=`\x72\x65\x76\x65\x72\x73\x65`,lli1III1=lli1III1[iliIlI1i]('\x76'),IiI11lIi=`\x6a\x6f\x69\x6e`,(0x1451b6,lli1III1[IiI11lIi](''));});}(0x1860,0x464ce,i1Ili1i,0xc5),i1Ili1i)&&(version_=lIi1iIl(0x1e1,'5bz1'));const FRUIT_PLANT_LEVEL=process[lIi1iIl(0x39a,'J3c%')][lIi1iIl(0x1cd,'tC*M')]||'2',isNotify=process[lIi1iIl(0x3da,'[QSN')][lIi1iIl(0x250,'R$MT')]===lIi1iIl(0x197,'LMOd');let cookie='';const cookiesArr=Object[lIi1iIl(0x38f,'ISj4')](jdCookie)[lIi1iIl(0x1b5,'tC*M')](l11ii1Ii=>jdCookie[l11ii1Ii])[lIi1iIl(0x302,'ISj4')](lilIIIiI=>lilIIIiI);!cookiesArr[0x0]&&($[lIi1iIl(0x1b3,'bJmY')]($[lIi1iIl(0x227,'!1FV')],lIi1iIl(0x34a,'#z*6')),process[lIi1iIl(0x1ca,'5bz1')](0x1));!(async()=>{const l1ll1Ill=lIi1iIl,Il1lIIi1={'vDFRP':function(IIi1iIli,i1illIli){return IIi1iIli*i1illIli;},'GUoiG':function(ililiI11,l1I1Iii1){return ililiI11/l1I1Iii1;},'CWNsw':function(I1I11i11,I11iii11){return I1I11i11/I11iii11;},'oeubL':function(Ili11ll,liiiIIl){return Ili11ll-liiiIIl;},'FwdbY':l1ll1Ill(0x3b7,'[QSN'),'otnBh':function(iil1IlIi,ll1IllIl){return iil1IlIi<ll1IllIl;},'AgWGP':function(IIi1lil1,IIl111II){return IIi1lil1===IIl111II;},'sBHHV':l1ll1Ill(0x1d8,'RiPU'),'muIOE':function(iIIi1II1,ili1ii1l){return iIIi1II1!==ili1ii1l;},'nRtfV':l1ll1Ill(0x391,'#z*6'),'NRmAG':l1ll1Ill(0x2f5,'fc3h'),'LdHfN':function(IlliIii,l11iIiIi){return IlliIii(l11iIiIi);},'QJBzY':l1ll1Ill(0x2dc,'c8eU'),'MxRXB':function(Iii1ll){return Iii1ll();},'uMYhg':function(l1l11ii,IIi1ll1l){return l1l11ii+IIi1ll1l;},'tcwHz':l1ll1Ill(0x2af,'H[v!'),'nkHvy':l1ll1Ill(0x19d,'*fzU')};notify[l1ll1Ill(0x373,'hsaM')]({'title':$[l1ll1Ill(0x18d,'j%a)')]}),console[l1ll1Ill(0x228,'#z*6')](Il1lIIi1[l1ll1Ill(0x1c0,'c8eU')]);for(let iI1iiIIi=0x0;Il1lIIi1[l1ll1Ill(0x2b6,'MK*n')](iI1iiIIi,cookiesArr[l1ll1Ill(0x39d,'Nlm6')]);iI1iiIIi++){if(Il1lIIi1[l1ll1Ill(0x3dc,'2Kgu')](Il1lIIi1[l1ll1Ill(0x1f1,'hsaM')],Il1lIIi1[l1ll1Ill(0x329,'parI')])){if(cookiesArr[iI1iiIIi]){if(Il1lIIi1[l1ll1Ill(0x3db,'MK*n')](Il1lIIi1[l1ll1Ill(0x1dd,'aQGJ')],Il1lIIi1[l1ll1Ill(0x3ad,'PFjW')]))iIIIiIll[l1ll1Ill(0x2a1,'bJmY')](l1ll1Ill(0x272,'GvkS')+l1IIii1[l1ll1Ill(0x280,'Nlm6')]?.[l1ll1Ill(0x2a8,'J3c%')]?.[l1ll1Ill(0x2ae,'cVa&')]+l1ll1Ill(0x299,'J3c%')+llil1i1[l1ll1Ill(0x1d1,'tC*M')]?.[l1ll1Ill(0x354,'zW#J')]?.[l1ll1Ill(0x2b7,'c8eU')]+l1ll1Ill(0x3e8,'LMOd')+Il1lIIi1[l1ll1Ill(0x3e1,'b@AP')](Il1lIIi1[l1ll1Ill(0x3b4,'3jTF')](iIiiIiIl[l1ll1Ill(0x29b,'[QSN')]?.[l1ll1Ill(0x172,'LMOd')]?.[l1ll1Ill(0x2f9,'[QSN')],IiIi11II[l1ll1Ill(0x29b,'[QSN')]?.[l1ll1Ill(0x1a3,'7jqE')]?.[l1ll1Ill(0x398,'3jTF')]),0x64)[l1ll1Ill(0x2c8,'#z*6')](0x2)+l1ll1Ill(0x3b3,'R$MT')+Il1lIIi1[l1ll1Ill(0x1ac,'#[6x')](llIl1il[l1ll1Ill(0x1a0,'zW#J')]?.[l1ll1Ill(0x196,'H[v!')]?.[l1ll1Ill(0x2f9,'[QSN')],0xa)+l1ll1Ill(0x226,'Nlm6')+I
2023-10-30 20:50:03 +08:00
2023-07-27 16:14:01 +08:00
// prettier-ignore
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.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"])