faker3/jd_clean_coupon.js

14 lines
88 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-08-28 14:58:15 +08:00
function dPaJu1(){}var VPf5Q13=Object['defineProperty'],am98jU,AhyvjDY,N_uy1n,G26r3Ou,IjAbpG,LmHKzKh,qKok2tG,UDCyLJ_,wAJ03xR,vHJm95,KNAm3r,FLJWmTP,JDa5k0,iFlufPf,WHmicj,c_Ehnrb,oHyFno,D4oQF4R;function szntkXE(dPaJu1){return am98jU[dPaJu1>-0x21?dPaJu1<-0x21?dPaJu1-0x41:dPaJu1+0x20:dPaJu1-0x7]}am98jU=nLB1HF();function Lmcxwu(dPaJu1,VPf5Q13){return AhyvjDY(dPaJu1,'length',{value:VPf5Q13,configurable:szntkXE(0x8c)})}dPaJu1(AhyvjDY=Object.defineProperty,N_uy1n=HtXiNqw((dPaJu1,VPf5Q13)=>{return VPf5Q13(dPaJu1())},0x2)(rbxs1n,o3IZXg1));var IYV0lK=[],THOju6v=[_gDU_yS(szntkXE(-0x14)),_gDU_yS(szntkXE(-0xb)),'b}{x|8>P',_gDU_yS(szntkXE(-0x12)),_gDU_yS(0x3),_gDU_yS(szntkXE(-0x15)),_gDU_yS(szntkXE(0x8)),_gDU_yS(0x6),_gDU_yS(0x7),_gDU_yS(szntkXE(0x16)),_gDU_yS(0x9),_gDU_yS(szntkXE(0x1f)),_gDU_yS(szntkXE(0x20)),_gDU_yS(0xc),_gDU_yS(szntkXE(-0x7)),_gDU_yS(szntkXE(0x1d)),_gDU_yS(0xf),_gDU_yS(0x10),_gDU_yS(szntkXE(0x24)),_gDU_yS(0x12),_gDU_yS(0x13),_gDU_yS(0x14),_gDU_yS(szntkXE(0x26)),_gDU_yS(0x16),_gDU_yS(0x17),_gDU_yS(0x18),_gDU_yS(szntkXE(0x43)),_gDU_yS(szntkXE(-0x1f)),_gDU_yS(szntkXE(-0x20)),_gDU_yS(szntkXE(0x2a)),_gDU_yS(szntkXE(-0x1e)),_gDU_yS(0x1e),_gDU_yS(szntkXE(0x31)),_gDU_yS(szntkXE(-0x20)),_gDU_yS(0x20),_gDU_yS(0x21),_gDU_yS(0x21),_gDU_yS(szntkXE(0x83)),_gDU_yS(0x22),_gDU_yS(0x23),_gDU_yS(0x24),'4zeH|f$xR5mhk&5!3RZ',_gDU_yS(0x25),_gDU_yS(szntkXE(0x33)),_gDU_yS(szntkXE(0x34)),_gDU_yS(0x28),_gDU_yS(0x29),_gDU_yS(szntkXE(0x35)),_gDU_yS(szntkXE(0x82)),_gDU_yS(szntkXE(-0x1f)),_gDU_yS(szntkXE(-0x20)),_gDU_yS(szntkXE(-0x17)),_gDU_yS(szntkXE(0x37)),_gDU_yS(0x2e),_gDU_yS(0x2f),_gDU_yS(szntkXE(0x38)),_gDU_yS(szntkXE(0x12)),']Uf|Ij3&&v',_gDU_yS(0x32),_gDU_yS(0x33),_gDU_yS(0x34),_gDU_yS(0x35),_gDU_yS(0x36),_gDU_yS(0x37),_gDU_yS(0x38),_gDU_yS(szntkXE(-0x1e)),_gDU_yS(0x39),_gDU_yS(0x3a),'EU`O9|DSG',_gDU_yS(0x3b),_gDU_yS(0x3c),_gDU_yS(szntkXE(0x32)),_gDU_yS(szntkXE(-0x1d)),_gDU_yS(0x3e),_gDU_yS(szntkXE(-0xd)),_gDU_yS(szntkXE(-0x1b)),_gDU_yS(szntkXE(0x40)),_gDU_yS(0x42),_gDU_yS(0x43),_gDU_yS(szntkXE(0x45)),_gDU_yS(0x45),_gDU_yS(0x46),_gDU_yS(szntkXE(-0x1d)),_gDU_yS(0x2c),_gDU_yS(0x47),szntkXE(-0x1a),_gDU_yS(szntkXE(0x36)),_gDU_yS(szntkXE(0x21)),_gDU_yS(0x4a),'{Q32M|C1',_gDU_yS(0x4b),_gDU_yS(0x4c),_gDU_yS(szntkXE(0x50)),'\u007b\u0051\u0033\u0032\u004d\u007c\u0038\u0038\u0040\u006c',_gDU_yS(szntkXE(-0x1c)),_gDU_yS(0x4a),_gDU_yS(szntkXE(0x4c)),'\u007c\u0030\u0045\u005e\u0051',_gDU_yS(szntkXE(0xd)),_gDU_yS(szntkXE(0x2)),_gDU_yS(0x24),'Fsy|4yp',_gDU_yS(0x50),_gDU_yS(szntkXE(0x75)),_gDU_yS(szntkXE(0x4f)),_gDU_yS(0x53),_gDU_yS(0x54),_gDU_yS(0x55),_gDU_yS(0x56),_gDU_yS(0x4f),_gDU_yS(szntkXE(-0x1c)),_gDU_yS(szntkXE(0x57)),_gDU_yS(szntkXE(0x22)),_gDU_yS(0x59),_gDU_yS(szntkXE(0x54)),_gDU_yS(szntkXE(0x4)),_gDU_yS(0x5c),'xenv=n0lcJ:eyu)z)k>nzc)|(g474.2_.ZA?k0y+?',_gDU_yS(szntkXE(0x59)),_gDU_yS(0x5e),_gDU_yS(0x21),_gDU_yS(0x5e),_gDU_yS(szntkXE(-0x1d)),_gDU_yS(0x5f),_gDU_yS(szntkXE(-0x1b)),_gDU_yS(szntkXE(0xa)),szntkXE(-0x1a),_gDU_yS(0x60),_gDU_yS(szntkXE(-0x1d)),_gDU_yS(0x61),_gDU_yS(szntkXE(-0x19)),_gDU_yS(0x63),_gDU_yS(szntkXE(-0x16)),_gDU_yS(0x65),_gDU_yS(0x66),_gDU_yS(szntkXE(-0x1d)),_gDU_yS(0x2c),_gDU_yS(szntkXE(-0x18)),_gDU_yS(szntkXE(0x27)),_gDU_yS(szntkXE(-0x1d)),_gDU_yS(0x61),_gDU_yS(szntkXE(-0x19)),_gDU_yS(0x69),_gDU_yS(0x2c),_gDU_yS(szntkXE(-0x18)),_gDU_yS(0x6a),_gDU_yS(szntkXE(0x19)),_gDU_yS(szntkXE(0x6c)),_gDU_yS(0x21),_gDU_yS(szntkXE(-0x17)),_gDU_yS(0x6d),'\x34\x4b\x77\x6a\x49\x7c\x4c\x58\x67',_gDU_yS(0x6e),_gDU_yS(szntkXE(0x6f)),'1;|G%9[','uhY||%qp!q@8z',_gDU_yS(szntkXE(-0x16)),_gDU_yS(szntkXE(0x65)),_gDU_yS(0x71),'\u002c\u002c\u0038\u004f\u003b\u007c\u0045\u0046','4,"Oy|p',_gDU_yS(szntkXE(0x69)),_gDU_yS(szntkXE(0x66)),_gDU_yS(0x74),_gDU_yS(szntkXE(0x78)),_gDU_yS(0x76),_gDU_yS(0x77),_gDU_yS(szntkXE(0x7c)),_gDU_yS(0x79),_gDU_yS(0x7a),_gDU_yS(0x7b),_gDU_yS(0x7c),'==pS4|[',_gDU_yS(0x7d),_gDU_yS(szntkXE(0x86)),_gDU_yS(0x7f),_gDU_yS(0x80),_gDU_yS(0x81),'S/x>K|<x8x7Ez',_gDU_yS(0x82),_gDU_yS(0x83),'Yh1km|?k`^{Mw#vTFP#>i1x%.qvocL',_gDU_yS(szntkXE(0xe)),_gDU_yS(0x85),_gDU_yS(0x86),'*/E|W{x%.','6<|G','\x41\x25\x30\x64\x77\x7c\x70\x72\x78\x53\x40\x6f\x
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