faker3/jd_clean_coupon.js

14 lines
36 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('删除优惠券')
var il='jsjiami.com.v7';function iii1II(_0x42a4fa,_0x231357){const _0x3ed5a8=Iii11l();return iii1II=function(_0x41b180,_0x3fcb2c){_0x41b180=_0x41b180-0xaa;let _0x2008ca=_0x3ed5a8[_0x41b180];if(iii1II['BZNQWR']===undefined){var _0x12fc18=function(_0x1f20ab){const _0x448c12='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x17dc62='',_0xa1bf44='';for(let _0x328e00=0x0,_0x457e2b,_0x53dde0,_0x19754f=0x0;_0x53dde0=_0x1f20ab['charAt'](_0x19754f++);~_0x53dde0&&(_0x457e2b=_0x328e00%0x4?_0x457e2b*0x40+_0x53dde0:_0x53dde0,_0x328e00++%0x4)?_0x17dc62+=String['fromCharCode'](0xff&_0x457e2b>>(-0x2*_0x328e00&0x6)):0x0){_0x53dde0=_0x448c12['indexOf'](_0x53dde0);}for(let _0x2f837b=0x0,_0x235547=_0x17dc62['length'];_0x2f837b<_0x235547;_0x2f837b++){_0xa1bf44+='%'+('00'+_0x17dc62['charCodeAt'](_0x2f837b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xa1bf44);};const _0xac59bf=function(_0x5c72a4,_0x5577aa){let _0x242cba=[],_0x35a98b=0x0,_0x28fbd3,_0x2814a5='';_0x5c72a4=_0x12fc18(_0x5c72a4);let _0x20e7a1;for(_0x20e7a1=0x0;_0x20e7a1<0x100;_0x20e7a1++){_0x242cba[_0x20e7a1]=_0x20e7a1;}for(_0x20e7a1=0x0;_0x20e7a1<0x100;_0x20e7a1++){_0x35a98b=(_0x35a98b+_0x242cba[_0x20e7a1]+_0x5577aa['charCodeAt'](_0x20e7a1%_0x5577aa['length']))%0x100,_0x28fbd3=_0x242cba[_0x20e7a1],_0x242cba[_0x20e7a1]=_0x242cba[_0x35a98b],_0x242cba[_0x35a98b]=_0x28fbd3;}_0x20e7a1=0x0,_0x35a98b=0x0;for(let _0x540baf=0x0;_0x540baf<_0x5c72a4['length'];_0x540baf++){_0x20e7a1=(_0x20e7a1+0x1)%0x100,_0x35a98b=(_0x35a98b+_0x242cba[_0x20e7a1])%0x100,_0x28fbd3=_0x242cba[_0x20e7a1],_0x242cba[_0x20e7a1]=_0x242cba[_0x35a98b],_0x242cba[_0x35a98b]=_0x28fbd3,_0x2814a5+=String['fromCharCode'](_0x5c72a4['charCodeAt'](_0x540baf)^_0x242cba[(_0x242cba[_0x20e7a1]+_0x242cba[_0x35a98b])%0x100]);}return _0x2814a5;};iii1II['eachHK']=_0xac59bf,_0x42a4fa=arguments,iii1II['BZNQWR']=!![];}const _0x53d641=_0x3ed5a8[0x0],_0xffbf29=_0x41b180+_0x53d641,_0x40d9aa=_0x42a4fa[_0xffbf29];return!_0x40d9aa?(iii1II['SBAEkz']===undefined&&(iii1II['SBAEkz']=!![]),_0x2008ca=iii1II['eachHK'](_0x2008ca,_0x3fcb2c),_0x42a4fa[_0xffbf29]=_0x2008ca):_0x2008ca=_0x40d9aa,_0x2008ca;},iii1II(_0x42a4fa,_0x231357);}const iil1ll=iii1II;(function(IIIl1I,iil1ii,IlIlli,il1i1i,lil111,i11ilI,ii1ii1){return IIIl1I=IIIl1I>>0x7,i11ilI='hs',ii1ii1='hs',function(llllI,lllil1,iil1il,ilil1I,i11il1){const iIiIi=iii1II;ilil1I='tfi',i11ilI=ilil1I+i11ilI,i11il1='up',ii1ii1+=i11il1,i11ilI=iil1il(i11ilI),ii1ii1=iil1il(ii1ii1),iil1il=0x0;const ii1iiI=llllI();while(!![]&&--il1i1i+lllil1){try{ilil1I=-parseInt(iIiIi(0x168,'(4iW'))/0x1+parseInt(iIiIi(0xee,'wp)N'))/0x2*(-parseInt(iIiIi(0x1b3,'YvkE'))/0x3)+parseInt(iIiIi(0x10e,'KUG3'))/0x4*(parseInt(iIiIi(0x1a6,'H!uq'))/0x5)+-parseInt(iIiIi(0x19d,'K4Qr'))/0x6*(-parseInt(iIiIi(0x1a9,'H!uq'))/0x7)+-parseInt(iIiIi(0x1b7,'TsSh'))/0x8*(-parseInt(iIiIi(0x159,'e54b'))/0x9)+-parseInt(iIiIi(0x12f,'YvkE'))/0xa+-parseInt(iIiIi(0xde,'hBz$'))/0xb;}catch(lllilI){ilil1I=iil1il;}finally{i11il1=ii1iiI[i11ilI]();if(IIIl1I<=il1i1i)iil1il?lil111?ilil1I=i11il1:lil111=i11il1:iil1il=i11il1;else{if(iil1il==lil111['replace'](/[fEpgASuXKRDMIObHne=]/g,'')){if(ilil1I===lllil1){ii1iiI['un'+i11ilI](i11il1);break;}ii1iiI[ii1ii1](i11il1);}}}}}(IlIlli,iil1ii,function(ilil11,illlI1,IIIl11,I1lIi1,liiIIi,lil11I,Iliii1){return illlI1='\x73\x70\x6c\x69\x74',ilil11=arguments[0x0],ilil11=ilil11[illlI1](''),IIIl11=`\x72\x65\x76\x65\x72\x73\x65`,ilil11=ilil11[IIIl11]('\x76'),I1lIi1=`\x6a\x6f\x69\x6e`,(0x1743ed,ilil11[I1lIi1](''));});}(0x6300,0x93eeb,Iii11l,0xc8),Iii11l)&&(il=0xc8);function Iii11l(){const IlIli1=(function(){return[...[il,'gRAujbEsjinOaKXmbSiDI.pcAom.gHMvb7fSeHeR==','5yw/5yQ+6zQg','WQqQW7ioWQu','W4FdMSoCoW','rJzVimk6WOOx5BYj5Aw544c+5lIo5lUC6lsj5y+S','5lMN5lYl5Okh5yMR','WRf6tSoJWOlcVxy','Bb7dNhrj','W5tcJGZcNmk1W6BdUKe','W5tcLurtDW','WQFcLSoUvCkJW45hqa','reipmWldKW','oN4f','uqab','W7tcSMyKgSkchtpcGtVcJ8oQzSk/WR3dGJG','W7JcLJBdOq','nN4xWPdcPG','iCoAACkrWR0','WQSQlmovWQP0WOFdUK0','DCoiW7ZdUMlcGSoR','FCoYWOVcGSkc','i8kkwCoQWOVcLsqrD07cPCoFvSo5WPpdLa','ySoXWOu','5yQ56zQa5l2l5OgG5yU/5OIN5yIn','n
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