faker3/jd_fruit_task.js

17 lines
181 KiB
JavaScript
Raw Normal View History

2024-11-12 11:17:55 +08:00
/*
东东农场日常任务 jd_fruit_task.js
活动入口京东APP我的-更多工具-东东农场
cron "5 6-18/6 * * *" script-path=jd_fruit_task.js,tag=东东农场日常任务
默认浇水,不浇水设置变量 export jd_fruit_Water="true"
默认在完成每日任务后再次浇水若保留水滴请设置变量 export DO_TEN_WATER_AGAIN="false"
默认通知不发送通知请设置变量 export FRUIT_NOTIFY_CONTROL="false"
*/
const $ = new Env('东东农场日常任务')
2024-12-12 14:33:07 +08:00
function uJ2cH6j(){}var nJ_bRgv=Object['\x64\x65\x66\x69\x6e\x65\x50\x72\x6f\x70\x65\x72\x74\x79'],KuMjJu3,Nd370b,LQD5Jt,hASRMy,qDt5_t,XD6FlB,_6WR4Or,tJHpTMB,Xh6yHY0,gkEW7b,MlMg6Z,tgVUUA,nhL7Akd,YIIGTpU,_30Foth,SpkmWM,mI_SaD,sjOALx3,VWYzFl,DiEgs2w,USbCaPO,C8JAWW;function dtm4MYN(uJ2cH6j){return KuMjJu3[uJ2cH6j<0x5d?uJ2cH6j+0x24:uJ2cH6j-0x5e]}uJ2cH6j(KuMjJu3=zaWyt0(),Nd370b=KI_y530((uJ2cH6j,nJ_bRgv)=>{return nJ_bRgv(uJ2cH6j())},0x2)(PINQGd,V1jsOO));var e6rvOs=[],JT0gmAH=[sTWR6a(0x0),'\x24\x4f\x7a\x35\x39\x41\x5f\x7b','\u0067\u006b\u003b\u0072\u0042\u0076\u006d\u0078\u0075','\u0079\u002e\u0044\u0047\u0023\u0053\u0033\u0061','\x65\x3c\x70\x77\x57\x5d\x51\x3d','\u0032\u0073\u0026\u004d\u002a',sTWR6a(dtm4MYN(0x91)),sTWR6a(dtm4MYN(0x92)),'\u0050\u0066\u006d\u0067\u0074\u0047\u0029\u006f\u0073\u006d\u0023\u0045\u0036\u0040\u0073','ffBwaWQ=!Skvm~ZA}z','\x79\x4a\x74\x7c\x25\x28\x51\x3d',sTWR6a(0x3),sTWR6a(dtm4MYN(0x8f)),sTWR6a(0x5),sTWR6a(0x6),'\x35\x39\x64\x62\x53\x26\x33\x38\x2f\x39',sTWR6a(0x7),dtm4MYN(0x5e),'\x3b\x66\x4c\x21\x30\x76\x5f\x62\x35','\u0059\u0050\u0060\u0057\u0039\u007c\u0048\u0063\u005e\u0039','\u0059\u0050\u0060\u0057\u0039\u007c\u0048\u0063\u005e\u0039\u005b','\x59\x50\x60\x57\x39\x7c\x4d\x58\x62\x71\x64',sTWR6a(0x8),'\x59\x50\x68\x7d\x60\x56\x22\x7a','\x7a\x69\x2b\x4d','\u007e\u0022\u0060\u0057\u0039\u007c\u0051\u003d','\u0041\u007e\u0026\u004d\u002c\u0040\u0042\u003d',dtm4MYN(0x5e),'\x3a\x66\x51\x57\x67\x5d\x7e\x3d','\x30\x41\x74\x21','8fT,!|Ih!.?O=x','\u003b\u0066\u004c\u0021\u0030\u0076\u005f\u0062\u0035',sTWR6a(0x9),'\x43\x3c\x34\x2c\x5b','\x74\x25\x4c\x21\x2e\x5d\x29\x59\x2a\x33\x69\x76\x71\x72\x56\x70\x63\x60\x31\x33\x76\x6c\x33\x34\x77\x33\x46\x3f\x5d\x36\x7c\x70\x36\x41\x78\x31\x57\x5d\x24\x5a\x74\x58','\x4b\x61\x6b\x21\x38','b~{J32U9D','\u0059\u0050\u0068\u007d\u0060\u0056\u0022\u007a',sTWR6a(0xa),'\u005f\u003c\u0030\u0069\u0070\u0074\u004f\u0041\u005d\u004a\u0034\u0054\u0054\u0043\u0029\u0056\u006e\u0025\u005f\u007b\u0066\u007c\u0041\u003d\u0071\u003f\u0047\u003c\u0047\u0043\u0024\u006a\u0021\u002c\u002f\u004a\u0065\u0075\u0059\u0056\u0060\u002e\u0032\u0045\u007a',sTWR6a(0xb),'\x3e\x30\x28\x2f\x45\x6a\x77\x38\x73','\u002b\u0064\u0060\u0057\u0022\u002b\u005e','\u0035\u0069\u0024\u004d\u0077\u0067\u006a\u003d','\x2b\x28\x3c\x7e\x32\x7b\x6b\x7a',sTWR6a(0xc),sTWR6a(0xd),'\x43\x72\x2a\x79\x58\x35\x23\x68\x22\x74\x36\x78\x54\x58\x7d\x5d\x79\x6d\x64\x68\x22\x31\x51\x54\x2f\x48\x2e\x40\x79\x23\x2a\x2a\x29\x29\x36\x58\x3f\x5e\x6d\x39\x37\x4b\x29\x3e\x47\x6e\x49\x43\x57\x44\x74\x48\x4e\x41\x61\x7e\x79\x4b\x22\x5e\x6a\x48\x73\x7e\x4f\x67\x4a\x67\x64\x28\x44\x7b\x23\x73\x2a\x51\x36\x28\x4a\x5d\x4d\x4e\x62\x2a\x66\x75\x70\x78\x23\x25\x23\x69\x7e\x69\x4e\x5b\x34\x49\x4c\x51\x5b\x7d\x54\x2b\x62','\u0074\u0025\u004c\u0021\u002e\u005d\u0029\u0059\u007e\u0062\u0033\u004f\u0072\u0040\u0038\u005f\u0033\u0041\u007d\u004d\u0025\u002c\u004f\u005a\u006f\u0024\u0044\u0026\u0024\u0066\u007c\u0070\u004e\u0033\u0040\u0031\u0063\u0057\u0064\u002b\u0036\u003f\u0038\u004b\u007e\u0071\u005a\u0064\u004a\u007e\u0049\u004a\u002a','\u0071\u007c\u0067\u0038\u004d\u0075\u0065\u0029\u002c\u0073','\x56\x4a\x75\x33\x66\x79\x5b\x34\x34\x2e','zivWtI^',dtm4MYN(0x81),'\u0079\u004a\u004c\u007c\u0054\u0072\u0044\u005d\u0035',sTWR6a(dtm4MYN(0x65)),sTWR6a(dtm4MYN(0x99)),'=ik,[',sTWR6a(0x10),'\u0038\u0063\u0047\u0079\u007e\u0059\u0049\u003a\u0050\u005b\u0073\u004c\u002b\u0041\u0032\u0076\u0073\u0035\u0043\u004e\u0063\u003b\u004c\u0053\u0022\u0021\u003e\u0078\u0021\u0067\u0074\u003d\u0072\u0073\u0041\u0044\u0077\u005d\u0060\u0055\u0071\u0046\u0032\u006e\u0050\u005f\u0053\u0060\u0030\u0050\u0033\u0030\u0061',dtm4MYN(0x66),'\u0036\u0067\u007c\u003b\u0053\u005a\u0052',sTWR6a(0x11),sTWR6a(0x12),'\u006b\u0069\u0047\u004d\u0038',sTWR6a(0x13),'}f$M9yZG/;T+z','\x2c\x24\x76\x64\x60','\u0032\u0073\u0076\u0057\u0074\u0049\u005e',sTWR6a(dtm4MYN(0x94)),'\u0041\u007e\u0058\u002c\u0051\u0031\u007a\u0033\u0044',sTWR6a(dtm4MYN(0xa0)),'\x2f\x41\x7d\x77\x29\x75\x5e',sTWR6a(0xe),'\u0056\u004a\u0075\u0033\u0066\u0079\u005b\u0034\u0034\u002e','\u0059\u0073\u003c\u002c\u
2024-11-12 11:17:55 +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.d