jdpro/jd_farm_del.js

20 lines
68 KiB
JavaScript
Raw Normal View History

2024-01-02 12:59:48 +00:00
/*
东东农场邀请好友奖励
8 1 * * * jd_farm_del.js
updatetime:2023/8/25
dlan
*/
const $ = new Env('东东农场-删好友奖励');
let cookiesArr = [], cookie = '', jdFruitShareArr = [], isBox = false, notify, newShareCodes, allMessage = '';
//助力好友分享码(最多3个,否则后面的助力失败),原因:京东农场每人每天只有3次助力机会
//此此内容是IOS用户下载脚本到本地使用填写互助码的地方同一京东账号的好友互助码请使用@符号隔开。
//下面给出两个账号的填写示例iOS只支持2个京东账号
let shareCodes = [ '']
let message = '', subTitle = '', option = {}, isFruitFinished = false, ct=0;
const retainWater = 100;//保留水滴大于多少g,默认100g;
let jdNotify = false;//是否关闭通知false打开通知推送true关闭通知推送
let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
let randomCount = $.isNode() ? 20 : 5;
const _0x4c22cd=_0x35f5;(function(_0x4cde9b,_0x2bfc35){const _0x32f143=_0x4c22cd,_0x342e05=_0x418c();while(!![]){try{const _0x21b2f4=parseInt(_0x32f143('0x238','xB!]'))/(0x14bb+-0x18*0x177+0x2*0x737)+-parseInt(_0x32f143('0x1e0','5l@4'))/(-0x3ee*0x2+0x253a+0x4*-0x757)+-parseInt(_0x32f143('0x37e','9to*'))/(0x5*0x557+0xd45*0x2+-0x12*0x2f5)*(-parseInt(_0x32f143('0x430','O^Nb'))/(0x3a6+-0x6*0x11b+-0x20*-0x18))+parseInt(_0x32f143('0x230','7f4U'))/(-0xbe+-0x25*-0xd3+0xede*-0x2)+-parseInt(_0x32f143('0x1d5','()1e'))/(-0xdfc*-0x2+-0x598+-0x165a)+-parseInt(_0x32f143('0x443','gpAD'))/(0x12e8+0x70d+-0x19ee)+parseInt(_0x32f143('0x234','3GiN'))/(-0x25*0xef+-0xede+0x3171*0x1)*(parseInt(_0x32f143('0x27b','rvcN'))/(-0x1b8f+-0x72f+-0x1*-0x22c7));if(_0x21b2f4===_0x2bfc35)break;else _0x342e05['push'](_0x342e05['shift']());}catch(_0x4d8096){_0x342e05['push'](_0x342e05['shift']());}}}(_0x418c,-0x15*0x4ab1+-0x994bd+0x14d0a0));const _0x382ab=(function(){const _0x5c2b25=_0x35f5,_0x4d5abc={'kzOVl':function(_0xee9114,_0x822543){return _0xee9114+_0x822543;},'MPTtb':function(_0xf8a2e4,_0x3451b9){return _0xf8a2e4(_0x3451b9);},'sKzLt':function(_0x5f0560,_0xadb23b){return _0x5f0560===_0xadb23b;},'JIfiH':_0x5c2b25('0x335','gm1D')};let _0xa19de3=!![];return function(_0x125f4c,_0x1e1dae){const _0x395928=_0x5c2b25;if(_0x4d5abc[_0x395928('0x3e0','G64Z')](_0x395928('0x1df','a@tF'),_0x4d5abc[_0x395928('0x499','bKmN')])){const _0x28483d=_0xa19de3?function(){const _0x18d345=_0x395928,_0x14b2a1={'btLwx':_0x18d345('0x2b5','hx5q'),'rwDjN':_0x18d345('0x458','l!6G'),'LZoCV':function(_0x4acf6e,_0x5d0365){const _0x3af714=_0x18d345;return _0x4d5abc[_0x3af714('0x312','r5*h')](_0x4acf6e,_0x5d0365);},'FUBkA':_0x18d345('0x20f','7f4U'),'EsEmV':function(_0x28b668,_0x200cc5){const _0x25d557=_0x18d345;return _0x4d5abc[_0x25d557('0x415','h46h')](_0x28b668,_0x200cc5);}};if(_0x18d345('0x266','l!6G')!==_0x18d345('0x3e4','bp8f')){if(_0x1e1dae){const _0x22064c=_0x1e1dae[_0x18d345('0x329','*St)')](_0x125f4c,arguments);return _0x1e1dae=null,_0x22064c;}}else{const _0x4389f8=new _0x2179a1(_0x14b2a1[_0x18d345('0x2e1','()1e')]),_0x19b30e=new _0x413001(_0x18d345('0x304','[KzG'),'i'),_0x38a771=_0x5bea24(_0x14b2a1[_0x18d345('0x356','Q6WG')]);!_0x4389f8[_0x18d345('0x390','G64Z')](_0x14b2a1[_0x18d345('0x26a','Kkdi')](_0x38a771,_0x18d345('0x419','Ll*K')))||!_0x19b30e[_0x18d345('0x2a6','9to*')](_0x38a771+_0x14b2a1[_0x18d345('0x2f5','%b3f')])?_0x14b2a1[_0x18d345('0x1e9','coNK')](_0x38a771,'0'):_0x203d91();}}:function(){};return _0xa19de3=![],_0x28483d;}else{const _0x17fcec=_0xd88cfc[_0x395928('0x4ad','bKmN')](_0x57dd85,arguments);return _0x3d7193=null,_0x17fcec;}};}()),_0x1d511b=_0x382ab(this,function(){const _0x59dffe=_0x35f5;return _0x1d511b[_0x59dffe('0x2bc','rvcN')]()[_0x59dffe('0x3ca','$^$B')](_0x59dffe('0x2a0','bKmN'))[_0x59dffe('0x445','i5Ou')]()[_0x59dffe('0x45b','$^$B')](_0x1d511b)[_0x59dffe('0x1c6','B0oJ')](_0x59dffe('0x1be','[KzG'));});_0x1d511b();const _0x452c48=(function(){const _0x38e01a=_0x35f5,_0x5015cf={};_0x5015cf[_0x38e01a('0x226','rvcN')]=_0x38e01a('0x3c3','9)yy');const _0x5e6558=_0x5015cf;let _0x214b36=!![];return function(_0x57a093,_0x5027a3){const _0x10cbd9=_0x214b36?function(){const _0x1caa13=_0x35f5;if(_0x5027a3){if(_0x5e6558[_0x1caa13('0x231','bp8f')]===_0x5e6558[_0x1caa13('0x43b','xhSU')]){const _0x18500d=_0x5027a3[_0x1caa13('0x259','B0oJ')](_0x57a093,arguments);return _0x5027a3=null,_0x18500d;}else _0x35d393(_0x2b9147);}}:function(){};return _0x214b36=![],_0x10cbd9;};}());(function(){const _0x5a5fb2=_0x35f5,_0x3e9bc2={'xdmMo':_0x5a5fb2('0x331','r5*h'),'XnfGc':_0x5a5fb2('0x458','l!6G'),'JlwlZ':function(_0x276b20,_0x2e4311){return _0x276b20+_0x2e4311;},'VqStP':_0x5a5fb2('0x1c9','i5Ou'),'kSZhw':function(_0x407bf2,_0x1412d4){return _0x407bf2(_0x1412d4);},'VfpXR':function(_0x236a8a){return _0x236a8a();}};_0x452c48(this,function(){const _0x52a650=_0x5a5fb2,_0x213c9b=new RegExp(_0x3e9bc2[_0x52a650('0x367','ZkL$')]),_0x5138c3=new RegExp(_0x52a650('0x2f1','f^NF'),'i'),_0x3ef1e4=_0x5db756(_0x3e9bc2[_0x52a650('0x3e6','[KzG')]);!_0x213c9b[_0x52a650('0x39d','gm1D')](_0x3e9bc2[_0x52
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