mirror of https://github.com/KingRan/KR.git
12 lines
54 KiB
JavaScript
12 lines
54 KiB
JavaScript
|
/*
|
|||
|
[task_local]
|
|||
|
#京东抽奖机加购
|
|||
|
11 11 11 11 * jd_lottery_cart.js, tag=京东抽奖机加购, enabled=true
|
|||
|
|
|||
|
//变量:export JD_Lottery_cart="id" 多个使用 @ 连接
|
|||
|
*/
|
|||
|
const $ = new Env('京东抽奖机加购-KR');
|
|||
|
var version_='jsjiami.com.v7';const iIII1lII=lilliIli;(function(Iil1lIl1,iI1il1il,ililIll,I11llii,i1i1lI1I,IiII11I1,Ii1illii){return Iil1lIl1=Iil1lIl1>>0x3,IiII11I1='hs',Ii1illii='hs',function(I1IIIi1,l1lIi111,liililIl,Iili1iII,lIl1llI1){const iiIli1=lilliIli;Iili1iII='tfi',IiII11I1=Iili1iII+IiII11I1,lIl1llI1='up',Ii1illii+=lIl1llI1,IiII11I1=liililIl(IiII11I1),Ii1illii=liililIl(Ii1illii),liililIl=0x0;const II1ll1l=I1IIIi1();while(!![]&&--I11llii+l1lIi111){try{Iili1iII=parseInt(iiIli1(0xc4,'T4m]'))/0x1*(parseInt(iiIli1(0x171,'keW0'))/0x2)+parseInt(iiIli1(0x24d,'Lbv['))/0x3*(parseInt(iiIli1(0xff,'6CS0'))/0x4)+parseInt(iiIli1(0x161,'D@AA'))/0x5+parseInt(iiIli1(0x245,'^e5A'))/0x6*(-parseInt(iiIli1(0x27a,'T4m]'))/0x7)+parseInt(iiIli1(0x2ec,'6Xgt'))/0x8+parseInt(iiIli1(0x11b,'gIjH'))/0x9*(-parseInt(iiIli1(0xe6,'KI9m'))/0xa)+-parseInt(iiIli1(0x23d,'%ooV'))/0xb;}catch(lllil){Iili1iII=liililIl;}finally{lIl1llI1=II1ll1l[IiII11I1]();if(Iil1lIl1<=I11llii)liililIl?i1i1lI1I?Iili1iII=lIl1llI1:i1i1lI1I=lIl1llI1:liililIl=lIl1llI1;else{if(liililIl==i1i1lI1I['replace'](/[MkXFHKTUfNBqyxVJrSnp=]/g,'')){if(Iili1iII===l1lIi111){II1ll1l['un'+IiII11I1](lIl1llI1);break;}II1ll1l[Ii1illii](lIl1llI1);}}}}}(ililIll,iI1il1il,function(IilI1il1,I1il11I,l1l1IIi1,Iil111,iilllll1,i11ilil,I11ll1i){return I1il11I='\x73\x70\x6c\x69\x74',IilI1il1=arguments[0x0],IilI1il1=IilI1il1[I1il11I](''),l1l1IIi1=`\x72\x65\x76\x65\x72\x73\x65`,IilI1il1=IilI1il1[l1l1IIi1]('\x76'),Iil111=`\x6a\x6f\x69\x6e`,(0x12456a,IilI1il1[Iil111](''));});}(0x608,0x22bfd,I1IlillI,0xc3),I1IlillI)&&(version_=I1IlillI);const lIll1I1i=$[iIII1lII(0x287,'w)1]')]()?require(iIII1lII(0x1eb,'nQmy')):'',Ii11Iiil=$[iIII1lII(0x24e,'$JCe')]()?require(iIII1lII(0x102,'6Xgt')):'',ill1Ii1=require(iIII1lII(0x12c,'YQ#c'));let I1l1lIll=!![],lII1l1Ii=!![],IlIIlIi1='';$[iIII1lII(0x280,'nN@g')]=![];let I1iIiII=[],ilIl1I='',iIiIll1i;process[iIII1lII(0x235,'vheO')][iIII1lII(0x13c,'730^')]&&process[iIII1lII(0x157,'zR2r')][iIII1lII(0x2ae,')DW%')]!=''&&(IlIIlIi1=process[iIII1lII(0xe2,'6Xgt')][iIII1lII(0xd3,'s1Q6')][iIII1lII(0x2bf,'gIjH')]('@'));if($[iIII1lII(0x293,'vheO')]()){Object[iIII1lII(0x23a,'EO62')](Ii11Iiil)[iIII1lII(0x2f5,'$JCe')](iIlii111=>{const li1I11il=iIII1lII;I1iIiII[li1I11il(0x2d0,'^qkd')](Ii11Iiil[iIlii111]);});if(process[iIII1lII(0x13d,'d^O]')][iIII1lII(0x1be,'EO62')]&&process[iIII1lII(0x129,'$GKV')][iIII1lII(0x29b,'^qkd')]===iIII1lII(0x11c,'t(Ph'))console[iIII1lII(0x1a0,'vRWS')]=()=>{};}else I1iIiII=[$[iIII1lII(0x243,'rS^4')](iIII1lII(0x2dd,'#7e@')),$[iIII1lII(0x253,'os7#')](iIII1lII(0x200,'K4V@')),...iliI($[iIII1lII(0x253,'os7#')](iIII1lII(0x23e,'rS^4'))||'[]')[iIII1lII(0x26e,'730^')](IiIIiil=>IiIIiil[iIII1lII(0x1ee,'D8ex')])][iIII1lII(0x1e8,'YQ#c')](IIIiIIi1=>!!IIIiIIi1);!(async()=>{const l11IIi=iIII1lII,liiii111={'qSMiS':l11IIi(0x1f4,'Lbv['),'NdgRL':l11IIi(0x205,'Eh8@'),'PWtFg':l11IIi(0x15a,'os7#'),'bTlRS':function(IIIiiill,I11iIIiI){return IIIiiill<I11iIIiI;},'ZUJqn':l11IIi(0x19a,'Y&!^'),'FOzzc':function(IiIiIli1,i11liilI){return IiIiIli1===i11liilI;},'tVuUR':l11IIi(0x261,'PI$5'),'Rqzgl':l11IIi(0xf7,'os7#'),'wnHRR':function(I1Ilii1,Ii1i1lii){return I1Ilii1+Ii1i1lii;},'sXXBq':function(lilliIii,ilIIl11I){return lilliIii+ilIIl11I;},'AgQzu':l11IIi(0x1b7,'FSjk'),'zDYvF':function(l11il1il,lIil1li1){return l11il1il<lIil1li1;},'XMLIj':l11IIi(0x135,'xxUC'),'ODtCo':function(iI1I1){return iI1I1();}};if(!I1iIiII[0x0]){$[l11IIi(0x256,'cf&J')]($[l11IIi(0xd2,'nQmy')],liiii111[l11IIi(0xc3,'D8ex')],l11IIi(0xf4,'^e5A'),{'open-url':l11IIi(0x2e0,'nQmy')});return;}if(!IlIIlIi1){console[l11IIi(0x14e,'vheO')](liiii111[l11IIi(0x1fb,'$JCe')]);return;}for(let l1II1iIi=0x0;liiii111[l11IIi(0x1f3,'Ex6%')](l1II1iIi,I1iIiII[l11IIi(0x11f,'Lbv[')]);l1II1iIi++){if(l11IIi(0xea,'PI$5')!==liiii111[l11IIi(0x166,'nN@g')]){if(I1iIiII[l1II1iIi]){if(liiii111[l11IIi(0x18c,'730^')](liiii111[l11IIi(0x1ed,'nQmy')],liiii111[l11IIi(0xcb,'bQiQ')])){IiIi1iIi[l11IIi(0x240,'w)1]')](l11IIi(0x17b,'Eh8@'));return;}else{ilIl1I=I1iIiII[l1II1iIi],$[l11IIi(0x1ea,'sq(9')]=decodeURIComponent(ilIl1I[l11IIi(0x1e9,'os7#')](/pt_pin=([^; ]+)(?=;?)/)&&ilIl1I[l
|
|||
|
// prettier-ignore
|
|||
|
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
|