jdpro/jd_fruit.js

18 lines
192 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
更新时间2023-9-8
活动入口京东APP我的--东东农场
==========================Quantumultx=========================
[task_local]
#jd免费水果
15 3,13,18 * * * jd_fruit.js, tag=东东农场, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
变量
export NO_WATER='true' 完全不浇水浇水任务不做了
export FRUIT_PIN='pin1&pin2' 不浇水的pin多个&分隔使用pin控制就不要使用NO_WATER
export DO_TEN_WATER_AGAIN='true' 攒水滴只交10次水默认不攒水滴
export FRUIT_FAST_CARD='true' 使用快速浇水卡水多可开启
epxort FRUIT_DELAY='1000',设置等待时间(毫秒)默认请求5次接口等待5秒5000
*/
const $ = new Env('东东农场-任务');
2024-12-11 13:35:03 +00:00
var BbweBO,FJwMEym,fDkz4qu,dueV6V,yvnHYm,grRC5D2,NytFPGp,Ip3AgT,k5ID3hv,svD8n4,YEGaDQQ;const BpzoUm=[0x0,0x1,0x8,0xff,"length","undefined",0x3f,0x6,"fromCodePoint",0x7,0xc,"push",0x5b,0x1fff,0x58,0xd,0xe,0x70,!0x1,0x7f,0x80,0x84,0x85,0x87,0x88,0x8a,0x89,0xd9,0xdb,0xdf,0xe5,0xe7,0xef,0xf2,0xf3,!0x0,0xf6," ",0x10c,0x110,0x7d0,0x127,0x12c,0x12b,0x12d,0x131,0x134,0x132,0x137,0x3,"\u3011",0x13a,0x147,0x149,0x14a,0x145,"\n",0x12f,0x17f,0x128,0x18f,0x19e,0x19f,0x1a0,"0",0x1a9,0x1ac,0x1b3,0x1b4,0x1b1,0x1b9,"f",0x1c1,0x1c3,0x1cb,0x1d0,0x1ba,0x1d7,0x1d8,0x1d9,0x1db,0x1e3,0x1e4,0x1dc,0x1ed,0x1a7,0x1f4,0x1f5,0x19c,"\u6B21\n",0x205,0x206,0x64,0x2,0x20a,0x20b,0xa,0x219,0x3c,0x225,0x226,0x228,0x22e,0x236,0x237,0x233,0x239,0x238,0x23c,0x23f,0x24d,0x254,0x255,0x200,0x201,0x202,0x262,0x26b,0x263,0x276,0x277,0x1fe,0x1ff,0x288,"\u5F20",0x282,0x286,0x291,0x294,0x28c,0x28d,0x28e,0x284,0x292,0x295,0x298,0x29c,0x29a,0x29f,0x2a0,0x2a2,0x2a3,0x285,0x283,null,0x2ba,0x2bb,0x2b9,0x2bd,"\u6B21",0x2c5,0x2c6,0xc8,0x2c3,0x2c4,0x2cc,0x2c7,0x2cd,0x2cb,"g\n",0x2d6,0x2d8,0x2d9,0x2da,"\u6D47\u6C34",0x2d1,0x2d2,0x2cf,0x2d3,0x2d4,0x2d5,0x2d7,0x2db,0x2dc,0x2dd,0x2de,0x2df,0x2e0,0x2e1,0x2e2,0x2ee,0x2f6,0x2ef,0x3ff,0x10000,0xd800,0xdc00,0x1f,0xc0,0xf,0xe0,0x12,0xf0,0x2ff,0x300,0xf8,0x2f5,0x306,0x266,0x308,0x30c,0x3e8,0x315,0x316,0x312,0x31f,0x320,0x31c,0x323,0x31e,0x322,"\u83B7\u5F97",0x318,"\u7B2C",0x32e,0x330,"g",0x331,0x332,0x335,0x333,0x10,0x100,0x4,0xdbff,0xdfff,0xffff,0x18,0x20,0x5,0x13,0x40,0x261,0x343,0x344,0x346,0x32c,0xb2,0x265,0x32f,0x351,0x352,"-",":",0x358,0x35d,0x35e,0x360,0x34a,0x34b,0x34c,",",0x353,0x354,0x355,0x356,0x357,"\u3010",0x359,0x35a,0x35b,0x367,"\u662F","\u5426",0x36a,0x36c,0x371,"\u3010\u7B2C",0x37d,0x380,0x381,0x384,0x37e,0x383,0x385,0x388,"1","id",0x38b,"2",0x38d,0x38c,0x391,0x389,0x396,0x394,0x397,0x373,0x3a1,0x3a2,0x3a0,0x3a8,0x3a9,0x2b4,0x2b2,0x3ab,0x3ac,0x2b3,0x2b5,0x33f,0x39c,0x39d,0x39e,0x3ba,"\u7ED9",0x3a5,0x3c0,0x3c1,void 0x0,0xae,0x3c7,0x3ce,0x26e,0x8c,0x3d0,0x3d1,0xa0,0xd4,0x3c8,0x3c9,0x3ca,0x3cb,0x3d2,0xbe,0x3d3,0x3d4,0xb6,0xa2,0x2b6,0xce,0xb8,0xc4,0x9e,0x3db,"3",0xcc,0x3de,0xa8,0x92,0x8e,0x90,0x3e9,0xd2,0x3ec,0xaa,0x94,0xd6,0x227,0x345,0x3a4,0x3f2,0x31d,0xa4,0x3fb,0x3fc,"45","UA",0x3fd,0x400,0x401,0x402,0x403,0x404,0x2710,0x405,0x408,0x8b,";",0x407,0x41b,"?",0x41f,0x420,0x421,0x422,0x423,0x424,0x425,0x426,0x427,0x428,0x429,0x42a];function _AWA9Ja(BbweBO){var FJwMEym="vBImYDhFaPVrHiLpRojUENfelqdMnCQOkTXAgStJbcWGKZ<s*)4y%$[]x^2~6:/(@;85=,9_}3\"+w.!?1>u`|#z{0&7",fDkz4qu,dueV6V,yvnHYm,grRC5D2,NytFPGp,Ip3AgT,k5ID3hv;L19qGd(fDkz4qu=""+(BbweBO||""),dueV6V=fDkz4qu.length,yvnHYm=[],grRC5D2=BpzoUm[0x0],NytFPGp=BpzoUm[0x0],Ip3AgT=-BpzoUm[0x1]);for(k5ID3hv=BpzoUm[0x0];k5ID3hv<dueV6V;k5ID3hv++){var svD8n4=FJwMEym.indexOf(fDkz4qu[k5ID3hv]);if(svD8n4===-BpzoUm[0x1])continue;if(Ip3AgT<BpzoUm[0x0]){Ip3AgT=svD8n4}else{L19qGd(Ip3AgT+=svD8n4*BpzoUm[0xc],grRC5D2|=Ip3AgT<<NytFPGp,NytFPGp+=(Ip3AgT&BpzoUm[0xd])>BpzoUm[0xe]?BpzoUm[0xf]:BpzoUm[0x10]);do{L19qGd(yvnHYm.push(grRC5D2&BpzoUm[0x3]),grRC5D2>>=BpzoUm[0x2],NytFPGp-=BpzoUm[0x2])}while(NytFPGp>BpzoUm[0x9]);Ip3AgT=-BpzoUm[0x1]}}if(Ip3AgT>-BpzoUm[0x1]){yvnHYm.push((grRC5D2|Ip3AgT<<NytFPGp)&BpzoUm[0x3])}return XEAZQ7l(yvnHYm)}function AmuDG5(fDkz4qu){if(typeof BbweBO[fDkz4qu]===BpzoUm[0x5]){return BbweBO[fDkz4qu]=_AWA9Ja(FJwMEym[fDkz4qu])}return BbweBO[fDkz4qu]}L19qGd(BbweBO={},FJwMEym=["th[wyxD$op%1GI","+E<%E%e,aVG1gY","T*\"D<(_c%iYeu,>JQXohC~8jDV612q]n+v","rkfYR`FFZNP;wM{X][S%c1Hj4H^%AIbtO6N]q~~e2LL+QS5QgP3yz_v","g=p!Rt~cW/74>YNAdSqhF43y%U?>AL6Whd%Cc)9%Z~_(#*ZU}x\"D$}DFWo,1v","AC5kJs~i!x]9~p)d*_zn7#4b1PJA4i{X5PACx9*%$U{<vm.J","ASzYa>tI+E\")B","JesP(<\"%P]nMUt[c>9XM5$Q@@jk,Si]nF)G\"fw3i?HhR[ih","p(&a{!O,@H}5GmlXm[g]r4c>V/b%gMQC13Bh","iS^h5}4%S[cAs2;gSyzOI*R2@j7.1gXgHdq[p]AC*PCwvm5Sf[Nw%xv","u3?)$}cs<N.(5uoJ|Wo!+4I@~o838LnWWbvP;?bQ<x>CI>$c%b5D6*v","/m{PXb&cKo/3U~Bo#~=.suZ(P;K14uhqJ^XMAAng/rV}+M6gW=WC`,>BZ8*wv","rY^[`>F,@j93^*xX[b$V/XK<PEj/Gu`c8[|$~9{evpG%|m","1E@Ps9R<?j21~9LdfPsPR`2jx;Ruf:|X];x){Z)F]@!)i*+UrB","BHm}vJLIiL&.#*!bm[<3@*4Qc2lEsuXl!3PMW+CUu^e*w~7WA*B","x[f)r]yAZ8=8lmgS,/OYy2u2:rR+Jt
2024-06-28 07:47:44 +00:00
function Env(o,t){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((r,i)=>{s.call(this,t,(t,e,s)=>{t?i(t):r(e)})})}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.logLevels={debug:0,info:1,warn:2,error:3},this.logLevelPrefixs={debug:"[DEBUG] ",info:"[INFO] ",warn:"[WARN] ",error:"[ERROR] "},this.logLevel="info",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.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null,...s){try{return JSON.stringify(t,...s)}catch{return e}}getjson(t,e){let s=e;if(this.getdata(t))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(r=>{this.get({url:t},(t,e,s)=>r(s))})}runScript(a,o){return new Promise(r=>{let t=this.getdata("@chavy_boxjs_userCfgs.httpapi");t=t&&t.replace(/\n/g,"").trim();var e=(e=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"))?+e:20,[s,i]=(e=o&&o.timeout?o.timeout:e,t.split("@"));this.post({url:`http://${i}/v1/scripting/evaluate`,body:{script_text:a,mock_type:"cron",timeout:e},headers:{"X-Key":s,Accept:"*/*"},timeout:e},(t,e,s)=>r(s))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};this.fs=this.fs||require("fs"),this.path=this.path||require("path");var t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),r=!s&&this.fs.existsSync(e);if(!s&&!r)return{};r=s?t:e;try{return JSON.parse(this.fs.readFileSync(r))}catch(t){return{}}}writedata(){var t,e,s,r,i;this.isNode()&&(this.fs=this.fs||require("fs"),this.path=this.path||require("path"),t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),r=!(s=this.fs.existsSync(t))&&this.fs.existsSync(e),i=JSON.stringify(this.data),!s&&r?this.fs.writeFileSync(e,i):this.fs.writeFileSync(t,i))}lodash_get(t,e,s){let r=t;for(const t of e.replace(/\[(\d+)\]/g,".$1").split("."))if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,r,e){return Object(t)===t&&((r=Array.isArray(r)?r:r.toString().match(/[^.[\]]+/g)||[]).slice(0,-1).reduce((t,e,s)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(r[s+1])>>0==+r[s+1]?[]:{},t)[r[r.length-1]]=e),t}getdata(t){let e=this.getval(t);if(/^@/.test(t)){var[,s,r]=/^@(.*?)\.(.*?)$/.exec(t);if(s=s?this.getval(s):"")try{const t=JSON.parse(s);e=t?this.lodash_get(t,r,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){var[,r,i]=/^@(.*?)\.(.*?)$/.exec(e),a=this.getval(r),a=r?"null"===a?null:a||"{}":"{}";try{const e=JSON.parse(a);this.lodash_set(e,i,t),s=this.setval(JSON.stringify(e),r)}catch(e){this.lodash_set(a={},i,t),s=this.setval(JSON.stringify(a),r)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueF