faker3/jd_clean_coupon.js

14 lines
28 KiB
JavaScript
Raw Normal View History

2024-06-28 15:38:28 +08:00
/*
删除优惠券
环境变量JD_COUPON_PIN_FILTER_GOODS // 需删除优惠券的账号填入pin多个用@分割)
JD_COUPON_DELETE // 需删除优惠券的关键字(填入关键字,多个用英文逗号,@,换行分割)(默认删除:限购@部分商品)
JD_COUPON_EXCLUDE // 需保留的优惠券关键字(填入关键字,多个用英文逗号,@,换行分割)(默认保留:东东@农场@无门槛)
cron:1 1 1 1 *
*/
const $ = new Env('删除优惠券')
2024-07-28 00:58:58 +08:00
const _0x397af4=_0xe4be;function _0xe4be(_0xecdcc7,_0x410bea){const _0x401271=_0x4012();return _0xe4be=function(_0xe4be9,_0x20df39){_0xe4be9=_0xe4be9-0xd5;let _0xff5812=_0x401271[_0xe4be9];if(_0xe4be['XuOABi']===undefined){var _0x407f54=function(_0x1558d0){const _0x1136e6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x340fc1='',_0x37ced5='';for(let _0x3f67ec=0x0,_0x1464e8,_0x4eb2f3,_0x57596d=0x0;_0x4eb2f3=_0x1558d0['charAt'](_0x57596d++);~_0x4eb2f3&&(_0x1464e8=_0x3f67ec%0x4?_0x1464e8*0x40+_0x4eb2f3:_0x4eb2f3,_0x3f67ec++%0x4)?_0x340fc1+=String['fromCharCode'](0xff&_0x1464e8>>(-0x2*_0x3f67ec&0x6)):0x0){_0x4eb2f3=_0x1136e6['indexOf'](_0x4eb2f3);}for(let _0x43b232=0x0,_0xbb4773=_0x340fc1['length'];_0x43b232<_0xbb4773;_0x43b232++){_0x37ced5+='%'+('00'+_0x340fc1['charCodeAt'](_0x43b232)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x37ced5);};const _0x5b3332=function(_0x24cc56,_0x4fd424){let _0x422454=[],_0x21e707=0x0,_0x4e52b9,_0x1da85e='';_0x24cc56=_0x407f54(_0x24cc56);let _0x6d6000;for(_0x6d6000=0x0;_0x6d6000<0x100;_0x6d6000++){_0x422454[_0x6d6000]=_0x6d6000;}for(_0x6d6000=0x0;_0x6d6000<0x100;_0x6d6000++){_0x21e707=(_0x21e707+_0x422454[_0x6d6000]+_0x4fd424['charCodeAt'](_0x6d6000%_0x4fd424['length']))%0x100,_0x4e52b9=_0x422454[_0x6d6000],_0x422454[_0x6d6000]=_0x422454[_0x21e707],_0x422454[_0x21e707]=_0x4e52b9;}_0x6d6000=0x0,_0x21e707=0x0;for(let _0x318367=0x0;_0x318367<_0x24cc56['length'];_0x318367++){_0x6d6000=(_0x6d6000+0x1)%0x100,_0x21e707=(_0x21e707+_0x422454[_0x6d6000])%0x100,_0x4e52b9=_0x422454[_0x6d6000],_0x422454[_0x6d6000]=_0x422454[_0x21e707],_0x422454[_0x21e707]=_0x4e52b9,_0x1da85e+=String['fromCharCode'](_0x24cc56['charCodeAt'](_0x318367)^_0x422454[(_0x422454[_0x6d6000]+_0x422454[_0x21e707])%0x100]);}return _0x1da85e;};_0xe4be['pNcFjr']=_0x5b3332,_0xecdcc7=arguments,_0xe4be['XuOABi']=!![];}const _0x47f541=_0x401271[0x0],_0x2de75a=_0xe4be9+_0x47f541,_0x4432f9=_0xecdcc7[_0x2de75a];return!_0x4432f9?(_0xe4be['PMFOlq']===undefined&&(_0xe4be['PMFOlq']=!![]),_0xff5812=_0xe4be['pNcFjr'](_0xff5812,_0x20df39),_0xecdcc7[_0x2de75a]=_0xff5812):_0xff5812=_0x4432f9,_0xff5812;},_0xe4be(_0xecdcc7,_0x410bea);}(function(_0x5893a9,_0x114768){const _0x231006=_0xe4be,_0x17daef=_0x5893a9();while(!![]){try{const _0x573c8c=-parseInt(_0x231006(0xed,'WZJ$'))/0x1*(parseInt(_0x231006(0x117,'Hx54'))/0x2)+-parseInt(_0x231006(0x15a,'[Q[F'))/0x3*(parseInt(_0x231006(0x189,'Hx54'))/0x4)+parseInt(_0x231006(0x1a0,'4cWL'))/0x5+-parseInt(_0x231006(0x147,'Cn)X'))/0x6+-parseInt(_0x231006(0x192,')H&K'))/0x7*(-parseInt(_0x231006(0x165,'Edhn'))/0x8)+-parseInt(_0x231006(0x18c,'l]sc'))/0x9+parseInt(_0x231006(0x10c,'#YGX'))/0xa;if(_0x573c8c===_0x114768)break;else _0x17daef['push'](_0x17daef['shift']());}catch(_0xb776ce){_0x17daef['push'](_0x17daef['shift']());}}}(_0x4012,0x764f8));const jdCookie=require(_0x397af4(0xe4,'2Zeg')),notify=require(_0x397af4(0x150,'#YGX')),common=require(_0x397af4(0x1ab,'@v1%')),{H5st}=require(_0x397af4(0xf9,'t73!')),excludeKeywords=(process['env'][_0x397af4(0x100,'JX@5')]||_0x397af4(0xef,'[q7I'))[_0x397af4(0x16e,'Y3dg')](/[,@\n]+/g)[_0x397af4(0x174,'q*5k')](_0x5b3332=>_0x5b3332[_0x397af4(0x11a,'gh)a')]())[_0x397af4(0x167,'fzI%')](Boolean),requiredKeywords=(process[_0x397af4(0x135,'pxHT')][_0x397af4(0x19a,'ZAbn')]||'限购@部分商品')[_0x397af4(0x112,'q*5k')](/[,@\n]+/g)[_0x397af4(0xf3,'r%De')](_0x1558d0=>_0x1558d0[_0x397af4(0xe0,'&plp')]())[_0x397af4(0x148,'t73!')](Boolean),pinFilterGoods=(process[_0x397af4(0x127,'fAvK')]['JD_COUPON_PIN_FILTER_GOODS']||'')[_0x397af4(0x13a,'ww7]')]('@')[_0x397af4(0x129,'^dU%')](_0x1136e6=>_0x1136e6),isNotify=![];let cookie='';const cookiesArr=Object[_0x397af4(0x120,'JX@5')](jdCookie)[_0x397af4(0xde,'YJHt')](_0x340fc1=>jdCookie[_0x340fc1])[_0x397af4(0x17b,'&plp')](_0x37ced5=>_0x37ced5);!cookiesArr[0x0]&&($[_0x397af4(0x118,'U0Vt')]($['name'],'【提示】请先获取Cookie'),process['exit'](0x1));!(async()=>{const _0x4e09f4=_0x397af4;console['log'](_0x4e09f4(0x158,'^xOy')+$[_0x4e09f4(0xe9,'ZAbn')]+_0x4e09f4(0x154,'0@]c')),console[_0x4e09f4(0x185,'C*cq'
2024-06-28 15:38:28 +08:00
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