faker3/jd_XinFarm_task.js

23 lines
191 KiB
JavaScript
Raw Normal View History

2024-11-12 11:17:55 +08:00
/*
新东东农场任务
种植任务浇水
2024-11-21 14:54:16 +08:00
作物名称显示接口未返回种植商品名称 是因为自己手动种的只选了等级没选商品这是正常情况
2024-11-12 11:17:55 +08:00
环境变量
jd_XinFarm_plantSkuId // 需要种植的作物ID详见脚本打印
jd_XinFarm_autoPlant // 种植模式true/false 默认自动种植,自动随机种植等级价值最高的物品
jd_XinFarm_waternum // 浇水次数,默认 10次 自行修改
jd_XinFarm_retainWater // 快速浇水,默认不开启(有水滴门槛,满足要求后开启才会生效)
jd_XinFarm_Notify // 是否推送通知true/false默认不推送
cron:45 2-22/6 * * *
*/
const $ = new Env('新东东农场任务')
2025-01-17 14:55:56 +08:00
function BRVfbT(){}var iZ5V85=Object['\x64\x65\x66\x69\x6e\x65\x50\x72\x6f\x70\x65\x72\x74\x79'],ZTvpY9,hCCAi_,QgkVtTj,fm3PnS,wTUFbM,yQ01QRq,OlhlvoY,FIw2rhn,N2EXlw,zdcMkA,teEu1tk,el_UQ8o,PDbVVg,dBjJUuB,J1p9vY,BISShqw,qjMyDXA,qjeUzV,stJjh2V,hwwSOKr;function YDZurR(BRVfbT){return ZTvpY9[BRVfbT<-0x43?BRVfbT+0x4b:BRVfbT<0xe1?BRVfbT+0x42:BRVfbT+0x2c]}BRVfbT(ZTvpY9=IbMFfqs(),hCCAi_=kTREbM0((BRVfbT,iZ5V85)=>{return iZ5V85(BRVfbT())},0x2)(WApMtKH,QrPbc1));var leKJJu=[],OH734q=['\u0072\u003b\u0024\u0055\u0070\u0022\u0055\u0062','\u0037\u0067\u006e\u0055\u004d\u004a\u0050\u0048','\x72\x6c\x54\x74\x33\x3a\x5f\x37','R^|jbelC',mUFQOJ(0x0),'z9MO','\u007c\u003e\u005b\u004e\u004e\u0077\u0060\u0033\u007b\u0053\u002e\u0042\u0039\u006e\u0064\u0067\u002c\u002c\u0075\u002a\u0045\u0050\u002e\u0038\u002a','\x4b\x6d\x58\x62\x6a\x6f\x41','|>[NNw`3{S.BF481jnuLf43C','\u007c\u003e\u005b\u004e\u004e\u0077\u0060\u0033\u007b\u0053\u002e\u0042\u0053\u0058\u003e\u007c\u0067\u0039\u0050\u0062\u002c\u006b\u0057\u0066\u005a\u0053','|>[NNw`3{S.BB?/[NXdVq/i86SZ','\x7e\x5e\x6b\x3a\x64','\u007c\u003e\u005b\u004e\u004e\u0077\u0060\u0033\u007b\u0053\u002e\u0042\u004a\u006f\u003e\u0054\u0056\u003f\u0051\u006a\u0049',mUFQOJ(YDZurR(-0x8)),mUFQOJ(YDZurR(0x5)),')nS}c',mUFQOJ(YDZurR(-0x3)),mUFQOJ(0x4),mUFQOJ(YDZurR(0x1)),'\x64\x38\x7e\x2c\x2f',mUFQOJ(0x6),mUFQOJ(YDZurR(-0x5)),YDZurR(-0x42),'\x43\x58\x55\x3a\x64',mUFQOJ(YDZurR(0x4)),'\x3f\x2c\x35\x56\x55\x77\x38\x43','\u0056\u003f\u0023\u004f\u0049\u006f\u0041','\x68\x6e\x6c\x62\x7d\x65\x3f\x43','_9Ij/.A',mUFQOJ(YDZurR(0x9)),mUFQOJ(YDZurR(-0x35)),'\u0048\u006e\u0050\u0062\u0029\u007d\u0049\u004a\u005f\u0042\u007a\u006a\u003f\u005f\u003f\u0067\u004f\u0078','zZ[N]w|C',mUFQOJ(YDZurR(0xb)),mUFQOJ(0xc),'\u0079\u0040\u003e\u0072\u0044\u007c\u0029\u003a\u0076',mUFQOJ(YDZurR(0x0)),mUFQOJ(YDZurR(0xf)),'\u0073\u003f\u0068\u0036\u003b\u004c\u0064\u006b\u006b\u0053','/9r:}eGKVJhigX','\x68\x6d\x3e\x72\x75\x78\x79\x6b',mUFQOJ(0xf),mUFQOJ(0x10),'\u0048\u006e\u0025\u003a\u0029\u006f\u004d\u0057\u003b\u0037\u004c\u0059\u0078',mUFQOJ(0x11),'\x3d\x26\x22\x3b\x4b\x29\x41',mUFQOJ(0x12),mUFQOJ(0x13),'\u0034\u006d\u0050\u0062\u004d\u0076\u0041','[,Vj2yQC','\u0039\u003f\u0057\u003a\u006c\u0036\u0078\u0066\u002a','<,W:d',mUFQOJ(0x14),mUFQOJ(0x15),'\u0034\u006d\u0073\u007b\u007c\u0045\u0059\u0049\u007c\u0057\u0069','\x48\x6e\x23\x4f\x64\x7d\x34\x59\x7c\x4a\x56\x76\x3f\x5f\x3c\x67\x38\x78',mUFQOJ(YDZurR(-0x18)),YDZurR(-0x42),'\x77\x69\x5d\x4d\x60\x55\x74\x4d\x4a\x3f\x49\x56\x66\x75\x53','8n$bsP3Iu',mUFQOJ(0x17),YDZurR(-0x38),mUFQOJ(YDZurR(-0x3b)),mUFQOJ(0x10),YDZurR(-0x37),'\x7e\x5e\x7c\x6a\x33\x45\x6b\x3b\x3e\x35\x68\x35\x47\x7c\x34\x39\x49\x5a\x7e\x4e',mUFQOJ(0x19),mUFQOJ(0x1a),'\u0071\u002f\u0054\u0021\u0057\u004f\u003f\u0046\u0028\u005a\u002a',YDZurR(-0x41),'q>m<a72<ORJQlOWfVzy8*V5Rq1Bra,|5tikF^B,N7','F)cV',mUFQOJ(0x1b),mUFQOJ(0x1c),mUFQOJ(0x1d),'\x48\x44\x37\x32\x7e','\u0036\u006c\u0072\u0021\u0073\u0075\u007c','[V.fnLdkkS',YDZurR(-0x42),'\x5b\x2c\x4e\x7b',YDZurR(-0x34),mUFQOJ(0x18),'\x75\x58\x4a\x7b\x6a\x7d\x33\x43','\x4b\x6d\x5e\x3a\x31\x72\x69\x49\x6b\x53\x21\x59\x21\x2f\x4f\x7c\x38\x78',mUFQOJ(YDZurR(-0x16)),'\x5b\x2c\x4e\x7b',YDZurR(-0x12),'\x21\x2c\x26\x4f\x70',mUFQOJ(YDZurR(-0x6)),mUFQOJ(0x20),'\x29\x51\x44\x3a\x7e\x40\x6c\x43','\u0029\u0051\u0044\u003a\u007e\u0040\u006c\u0043','\u0068\u006e\u007e\u003a\u0023\u0036\u0041','pnIj(@lC',mUFQOJ(0x20),'\u0029\u0051\u0044\u003a\u007e\u0040\u006c\u0043',mUFQOJ(0x21),YDZurR(-0x40),mUFQOJ(0x15),mUFQOJ(0x22),'\u004c\u003f\u006b\u004e','9?J{d','OH2I&tUWm','0{@wgPx@u',mUFQOJ(YDZurR(0x6)),'\u005a\u0050\u005b\u003a\u0021\u0079\u007b\u0057\u0076\u004f','\u0024\u007a\u005e\u004e\u0021\u0076\u0025\u004b\u0043','\x21\x2c\x55\x3a\x64',mUFQOJ(0x24),mUFQOJ(0x25),YDZurR(-0x41),'\u0029\u0051\u0044\u003a\u007e\u0040\u006c\u0043',mUFQOJ(YDZurR(0x17)),'\x4b\x6d\x5e\x3a\x4b\x44\x28\x38\x2a',mUFQOJ(0x22),'\x4b\x6d\x5e\x3a\x4f\x25\x3d\x40\x55\x53\x50\x76\x48\x5f\x29\x39\x60\x6e\x6d',YDZurR(-0x40),mUFQOJ(YDZurR(0x18)),mUFQOJ(0x28),mUFQOJ(YDZurR(0x19)),'\u005b\u002c\u004e\u007b','\x29\x63\x7e\x46\x5d\x54\x3e\x26\x
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