faker3/jd_fruit_watering.js

23 lines
55 KiB
JavaScript
Raw Normal View History

2024-06-28 15:38:28 +08:00
/*
东东农场快速浇水
环境变量FRUIT_PLANT_LEVEL // 自动种植的作物等级正整数默认为2
FRUIT_WATERING_NOTIFY // 是否推送通知true/false默认不推送
每周或三天内只能领2次红包超过会领取失败
由于普通浇水太慢脚本会优先使用快速浇水卡
7 7 7 7 * jd_fruit_watering.js
*/
const $ = new Env('东东农场快速浇水')
const jdCookie = require('./jdCookie')
const notify = require('./function/sendJDNotify')
const common = require('./function/jdCommon')
const { H5st } = require('./function/jdCrypto')
var version_='jsjiami.com.v7';const iI11ii1I=I1iii1l1;(function(Iilli1il,I11i1ii1,I1lIlilI,llIl1iI,iIII1lI1,iliiiiI1,IIi1IiiI){return Iilli1il=Iilli1il>>0x2,iliiiiI1='hs',IIi1IiiI='hs',function(I1llIil1,IlIi111,l1IiIlII,lII1l1i,lliii1){const l1l1lI1=I1iii1l1;lII1l1i='tfi',iliiiiI1=lII1l1i+iliiiiI1,lliii1='up',IIi1IiiI+=lliii1,iliiiiI1=l1IiIlII(iliiiiI1),IIi1IiiI=l1IiIlII(IIi1IiiI),l1IiIlII=0x0;const IIIlIIlI=I1llIil1();while(!![]&&--llIl1iI+IlIi111){try{lII1l1i=-parseInt(l1l1lI1(0x303,'66T$'))/0x1+-parseInt(l1l1lI1(0x2de,'kOg$'))/0x2+-parseInt(l1l1lI1(0x2f0,'5vAU'))/0x3*(-parseInt(l1l1lI1(0x294,'EtPI'))/0x4)+parseInt(l1l1lI1(0x134,'kOg$'))/0x5+parseInt(l1l1lI1(0x16a,'5Te^'))/0x6*(-parseInt(l1l1lI1(0x16f,'r9cr'))/0x7)+parseInt(l1l1lI1(0x122,'*x8m'))/0x8+-parseInt(l1l1lI1(0x21c,'!hXr'))/0x9*(-parseInt(l1l1lI1(0x2f4,'jwle'))/0xa);}catch(I1IiIl1I){lII1l1i=l1IiIlII;}finally{lliii1=IIIlIIlI[iliiiiI1]();if(Iilli1il<=llIl1iI)l1IiIlII?iIII1lI1?lII1l1i=lliii1:iIII1lI1=lliii1:l1IiIlII=lliii1;else{if(l1IiIlII==iIII1lI1['replace'](/[FJCefKdhwXAVIEnRY=]/g,'')){if(lII1l1i===IlIi111){IIIlIIlI['un'+iliiiiI1](lliii1);break;}IIIlIIlI[IIi1IiiI](lliii1);}}}}}(I1lIlilI,I11i1ii1,function(iiI1111I,iIiii1II,I1lli,ii1lII1i,l1ilIiIi,iiIlli1,ilIiiII){return iIiii1II='\x73\x70\x6c\x69\x74',iiI1111I=arguments[0x0],iiI1111I=iiI1111I[iIiii1II](''),I1lli=`\x72\x65\x76\x65\x72\x73\x65`,iiI1111I=iiI1111I[I1lli]('\x76'),ii1lII1i=`\x6a\x6f\x69\x6e`,(0x146f9c,iiI1111I[ii1lII1i](''));});}(0x308,0x4c233,lIiIiliI,0xc4),lIiIiliI)&&(version_=iI11ii1I(0x264,'5vAU'));const FRUIT_PLANT_LEVEL=process[iI11ii1I(0x2b1,'OWR0')][iI11ii1I(0x1fe,'Aj3G')]||'2',isNotify=process[iI11ii1I(0x1df,'cjjn')][iI11ii1I(0xf3,'*x8m')]===iI11ii1I(0xc7,'ap1R');let cookie='';const cookiesArr=Object[iI11ii1I(0x30d,'#Swg')](jdCookie)[iI11ii1I(0x2a1,'5vAU')](l1Illll1=>jdCookie[l1Illll1])[iI11ii1I(0xe3,'o0hF')](iilii11I=>iilii11I);!cookiesArr[0x0]&&($[iI11ii1I(0x1c2,'&[5z')]($[iI11ii1I(0xfd,'EcuT')],iI11ii1I(0xb9,'bT&@')),process[iI11ii1I(0xd5,'foTV')](0x1));!(async()=>{const ll1IIIiI=iI11ii1I,l1iiiIl1={'jShjj':ll1IIIiI(0x1ad,'8xEG'),'VBqWl':ll1IIIiI(0x16b,'#Swg'),'AOgHk':function(illilil,Ii11lIiI){return illilil<Ii11lIiI;},'wLYLA':function(ilIIilIi,IiI1Ii11){return ilIIilIi===IiI1Ii11;},'fRqKl':ll1IIIiI(0x28e,'5Yly'),'NhiTv':ll1IIIiI(0x2ae,'5Yly'),'uSode':function(II11I,I111iili){return II11I+I111iili;},'pTPYs':function(l1il11I1){return l1il11I1();},'Vrusw':function(IIi1i1ii,l1iliiiI){return IIi1i1ii(l1iliiiI);},'syfMn':ll1IIIiI(0x2cc,'GLHW'),'PCXJq':function(Ili1iiiI,ilI1II1l){return Ili1iiiI===ilI1II1l;},'EUSwE':ll1IIIiI(0x1a2,'gsAr'),'CDOZF':ll1IIIiI(0x11a,'&[5z'),'zdYeT':ll1IIIiI(0x12a,'pDwg')};notify[ll1IIIiI(0x31c,'*x8m')]({'title':$[ll1IIIiI(0x29b,'kwuf')]}),console[ll1IIIiI(0x245,'q79P')](l1iiiIl1[ll1IIIiI(0x215,'vOHv')]);for(let llliiilI=0x0;l1iiiIl1[ll1IIIiI(0x18d,'ap1R')](llliiilI,cookiesArr[ll1IIIiI(0x113,'@4QB')]);llliiilI++){if(l1iiiIl1[ll1IIIiI(0x313,'r9cr')](l1iiiIl1[ll1IIIiI(0x2bc,'bT&@')],l1iiiIl1[ll1IIIiI(0x1ee,'!@4%')])){if(cookiesArr[llliiilI]){const iI1i1lI=l1iiiIl1[ll1IIIiI(0x274,'8xEG')][ll1IIIiI(0x12c,'G)2#')]('|');let i1liiI11=0x0;while(!![]){switch(iI1i1lI[i1liiI11++]){case'0':$[ll1IIIiI(0xec,'@4QB')]=l1iiiIl1[ll1IIIiI(0x280,'foTV')](llliiilI,0x1);continue;case'1':console[ll1IIIiI(0x111,'V0GH')](ll1IIIiI(0x226,'kOg$')+$[ll1IIIiI(0x2d3,'!hXr')]+'】'+($[ll1IIIiI(0xa6,'@4QB')]||$[ll1IIIiI(0x2f1,'kOg$')])+ll1IIIiI(0x26f,'xOBd'));continue;case'2':$['UA']=common[ll1IIIiI(0x2a5,'Aj3G')]($[ll1IIIiI(0x1f5,'*x8m')]);continue;case'3':$[ll1IIIiI(0x275,'K*jE')]='';continue;case'4':await l1iiiIl1[ll1IIIiI(0x2b4,'5Yly')](Main);continue;case'5':$[ll1IIIiI(0x2b6,'*4(U')]=notify[ll1IIIiI(0x18b,'V9U[')]($[ll1IIIiI(0x198,'kwuf')],$[ll1IIIiI(0x173,'pDwg')]);continue;case'6':$[ll1IIIiI(0x1fd,'xOBd')]=l1iiiIl1[ll1IIIiI(0x2e8,'5Yly')](decodeURIComponent,common[ll1IIIiI(0x157,'bT&@')](cookie,l1iiiIl1[ll1IIIiI(0x266,'vy9S')]));continue;case'7':cookie=cookiesArr[llliiilI];continue;}break;}}}else lIIlIiI1[ll1IIIiI(0x284,'K*jE')](I1lIIlii[ll1IIIiI(0x323,'U*@*')],l1iiiIl1[ll1IIIiI(0x298,'q79P'
// 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"])