jdpro/jd_fruit.js

22 lines
351 KiB
JavaScript
Raw Normal View History

2024-01-02 12:59:48 +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('东东农场-任务');
const retainWater = 100;//保留水滴大于多少g,默认100g;
let jdNotify = false;//是否关闭通知false打开通知推送true关闭通知推送
let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
const _0x1f2ac6=_0x92b0;(function(_0x531768,_0x3c4ed3){const _0x374eeb={_0x109c8f:'0x37c',_0x28568a:'x)tX',_0x1087d0:'0x245',_0x54969c:'$v0q',_0x1ebe65:'0x781',_0x582113:'(h8W',_0x107f0e:'0x78a',_0x3eaedb:'(zZJ',_0x21ab88:'0x89d',_0x3b3737:'Q99i',_0x5caa75:'0x528',_0x3075ad:'4^p%',_0x8a4c89:'0x441',_0xe8cff7:'rIna',_0x5bdc42:'0xf8',_0x4f4dc2:'u#JQ',_0x298cac:'0x8df',_0x455081:'ezGk',_0x2c5f8f:'0x2a1',_0x51a26b:'$v0q',_0x5a8244:'0x582',_0x10cecc:'JfWn',_0x19ef4a:'0x8a8',_0x4b1e36:'#Eob'},_0x1594d7=_0x92b0,_0x2e06b2=_0x531768();while(!![]){try{const _0x2766eb=parseInt(_0x1594d7(_0x374eeb._0x109c8f,_0x374eeb._0x28568a))/(-0x2b9*0xc+0xbe4+0x14c9)+-parseInt(_0x1594d7(_0x374eeb._0x1087d0,_0x374eeb._0x54969c))/(0x118a+-0x457*0x5+-0x61*-0xb)*(parseInt(_0x1594d7(_0x374eeb._0x1ebe65,_0x374eeb._0x582113))/(-0x17dd*-0x1+-0x2179+-0x1*-0x99f))+-parseInt(_0x1594d7(_0x374eeb._0x107f0e,_0x374eeb._0x3eaedb))/(-0x2459*-0x1+-0x2*-0x3b6+-0x1*0x2bc1)*(-parseInt(_0x1594d7(_0x374eeb._0x21ab88,_0x374eeb._0x3b3737))/(-0xd11+-0x3d*0x2+-0x7*-0x1f0))+parseInt(_0x1594d7(_0x374eeb._0x5caa75,_0x374eeb._0x3075ad))/(0xa71+-0x81*0x38+0x11cd)*(parseInt(_0x1594d7(_0x374eeb._0x8a4c89,_0x374eeb._0xe8cff7))/(0x1c35*0x1+-0x2693+0xa65*0x1))+parseInt(_0x1594d7(_0x374eeb._0x5bdc42,_0x374eeb._0x4f4dc2))/(-0x1871*-0x1+0x8*-0x30b+-0x11)*(parseInt(_0x1594d7(_0x374eeb._0x298cac,_0x374eeb._0x455081))/(-0x14fb+-0x5*-0x28f+-0x1a5*-0x5))+-parseInt(_0x1594d7(_0x374eeb._0x2c5f8f,_0x374eeb._0x51a26b))/(0x1*0xeb7+0x1d3*-0x3+-0x934*0x1)*(-parseInt(_0x1594d7(_0x374eeb._0x5a8244,_0x374eeb._0x10cecc))/(-0x261b+0x1*-0x7e1+0x2e07))+-parseInt(_0x1594d7(_0x374eeb._0x19ef4a,_0x374eeb._0x4b1e36))/(0x52c+-0xd*-0xfd+-0x2b*0x6b);if(_0x2766eb===_0x3c4ed3)break;else _0x2e06b2['push'](_0x2e06b2['shift']());}catch(_0x28ce62){_0x2e06b2['push'](_0x2e06b2['shift']());}}}(_0x2faf,-0x81307+0x5*0x26641+0x1*0x30113));const _0x1f0ab9=(function(){const _0x58f1b7={_0xd7e3e4:'0x24d',_0x55c6e5:'@do*',_0x1229c0:'0x69d',_0x4f425b:'eddj'},_0x4e5563={_0x4a9f48:'0x63f',_0x2d2cef:'dbE@',_0x27703a:'0x480',_0x30d06f:'uRSI',_0x113703:'0x200',_0x144bf7:'leVC',_0x4969b8:'0x624',_0x3bf2d5:'3%Hj',_0x4d77b2:'0x4c1',_0x1cdfd1:'Mbr8'},_0x5d57d7=_0x92b0,_0x469178={};_0x469178[_0x5d57d7(_0x58f1b7._0xd7e3e4,_0x58f1b7._0x55c6e5)]=_0x5d57d7(_0x58f1b7._0x1229c0,_0x58f1b7._0x4f425b);const _0x2399d0=_0x469178;let _0x2141f8=!![];return function(_0xfa4322,_0x3c7aa2){const _0x52f320={_0x334d69:'0x928',_0xb88b4a:'@QLl',_0x47e32b:'0x22a',_0x2979bc:'(zZJ',_0x5536a7:'0x5d6',_0x18ded2:'$o1d',_0x4da3cb:'0x8d0',_0x55ea14:')FG0',_0x27b8e8:'0x19a',_0x1f8249:'5#0&',_0x250cb5:'0x3c7',_0x53ed84:'6Q0I',_0x3bc291:'0x980',_0xc20d14:'dbE@',_0x44b36f:'0x4ab',_0x3bac07:']AXP'},_0x245f4e=_0x92b0,_0x4d9b66={};_0x4d9b66[_0x245f4e(_0x4e5563._0x4a9f48,_0x4e5563._0x2d2cef)]=function(_0x2f43f5,_0x472569){return _0x2f43f5!==_0x472569;};const _0x11baa4=_0x4d9b66;if(_0x2399d0[_0x245f4e(_0x4e5563._0x27703a,_0x4e5563._0x30d06f)]!==_0x245f4e(_0x4e5563._0x113703,_0x4e5563._0x144bf7))_0x70e7d4[_0x245f4e(_0x4e5563._0x4969b8,_0x4e5563._0x3bf2d5)](_0x245f4e(_0x4e5563._0x4d77b2,_0x4e5563._0x1cdfd1));else{const _0x4a494f=_0x2141f8?function(){const _0x1b843b=_0x92b0;if(_0x3c7aa2){if(_0x11baa4[_0x1b843b(_0x52f320._0x334d69,_0x52f320._0xb88b4a)](_0x1b843b(_0x52f320._0x47e32b,_0x52f320._0x2979bc),_0x1b843b(_0x52f320._0x5536a7,_0x52f320._0x18ded2))){const _0x2b84ef=_0x3c7aa2[_0x1b843b(_0x52f320._0x4da3cb,_0x52f320._0x55ea14)](_0xfa4322,arguments);return _0x3c7aa2=null,_0x2b84ef;}else _0x8081a[_0x1b843b(_0x52f320._0x27b8e8,_0x52f320._0x1f8249)](_0x1b843b(_0x52f320._0x250cb5,_0x52f320._0x53ed84)+_0x4d4dd6[_0x1b843b(_0x52f320._0x3bc291,_0x52f320._0xc20d14)](_0x34c4ad[_0x1b843b(_0x52f320._0x44b36f,_0x52f320._0x3bac07)]));}}:function(){};return _0x2141f8=![],_0x4a494f;}};}()),_0x84595d=_0x1f0ab9(this,function(){const _0x2a878={_0x2c5703:'0x571',_0x5c51d2:'leVC',_0x407ff3:'0xa18',_0x27867e:'PfN0',_0x597c8a:'0x136',_0x2e66ba:')FG0',_0x9010f7:'0x29e',_0x4ca3e3:')K45',_0xed7f1e:'0x443',_0x54e56c:']AXP',_0x268ab8:'0x8b2',_0x1efca0:'(h8W',_0x13d3c4:'0x5fe',_0x3c90a3:']AXP',_0x40ba28:
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