KR/jd_daily.js

25 lines
106 KiB
JavaScript
Raw Normal View History

2023-07-27 16:14:01 +08:00
/*
活动名称每日抢好礼 · 超级无线/超级会员
活动链接https://cjhy-isv.isvjcloud.com/wxShopFollowActivity/activity?activityId=<活动id>
https://lzkj-isv.isvjcloud.com/activity/daily/wx/indexPage?activityId=<活动id>
环境变量
export jd_daily_activityUrl // 活动链接
export jd_daily_openCard // 是否开卡,默认不开卡
export jd_daily_blacklist="" // 黑名单 用&隔开 pin值
export JD_CJ_OPEN="false" //关闭CJ相关活动运行
export JD_LZ_OPEN="false" //关闭LZ相关活动运行
cron:1 1 1 1 *
============Quantumultx===============
[task_local]
#CJ每日抢好礼通用活动
1 1 1 1 * jd_daily.js, tag=每日抢好礼通用活动, enabled=true
*/
const $ = new Env('每日抢好礼(超级无线/超级会员)')
var version_='jsjiami.com.v7';const llil1i=iii1II;(function(Il1ll1,I1i1lI,lil1li,ili1i1,Il1lli,l11I1i,I1i1l1){return Il1ll1=Il1ll1>>0x7,l11I1i='hs',I1i1l1='hs',function(ilIi11,ll1i1I,Il1lll,lil1iI,IIl11){const i1lIIi=iii1II;lil1iI='tfi',l11I1i=lil1iI+l11I1i,IIl11='up',I1i1l1+=IIl11,l11I1i=Il1lll(l11I1i),I1i1l1=Il1lll(I1i1l1),Il1lll=0x0;const iIli=ilIi11();while(!![]&&--ili1i1+ll1i1I){try{lil1iI=parseInt(i1lIIi(0x371,'!Cf^'))/0x1*(-parseInt(i1lIIi(0x123,'qN&m'))/0x2)+-parseInt(i1lIIi(0x3e3,'js8p'))/0x3*(parseInt(i1lIIi(0x349,'n3Fj'))/0x4)+parseInt(i1lIIi(0x3b5,'Ely]'))/0x5*(parseInt(i1lIIi(0x3d7,'Ely]'))/0x6)+-parseInt(i1lIIi(0x4e2,'cyaJ'))/0x7+-parseInt(i1lIIi(0x4b7,'XU1r'))/0x8+parseInt(i1lIIi(0x534,'1j^&'))/0x9*(-parseInt(i1lIIi(0x395,'oNU0'))/0xa)+-parseInt(i1lIIi(0x46c,')VAU'))/0xb*(-parseInt(i1lIIi(0x30e,']0lq'))/0xc);}catch(l11I1l){lil1iI=Il1lll;}finally{IIl11=iIli[l11I1i]();if(Il1ll1<=ili1i1)Il1lll?Il1lli?lil1iI=IIl11:Il1lli=IIl11:Il1lll=IIl11;else{if(Il1lll==Il1lli['replace'](/[IAJwtFluKxUTnOpkRCyLfh=]/g,'')){if(lil1iI===ll1i1I){iIli['un'+l11I1i](IIl11);break;}iIli[I1i1l1](IIl11);}}}}}(lil1li,I1i1lI,function(Iilil1,iIi1l1,llllII,llil1l,i1iI1i,li1iil,i1iI1l){return iIi1l1='\x73\x70\x6c\x69\x74',Iilil1=arguments[0x0],Iilil1=Iilil1[iIi1l1](''),llllII='\x72\x65\x76\x65\x72\x73\x65',Iilil1=Iilil1[llllII]('\x76'),llil1l='\x6a\x6f\x69\x6e',(0x136330,Iilil1[llil1l](''));});}(0x6400,0x1a7bd,Iii11l,0xca),Iii11l)&&(version_=Iii11l);const iiil1=$['isNode']()?require('./jdCookie'):'',liIil1=$[llil1i(0x504,'f2L%')]()?require(llil1i(0x4a9,'vs9B')):'',IIiIlI=require('./function/krgetToken'),ilII1I=require(llil1i(0x2e9,'8%$q')),iiIlI1=require(llil1i(0x42b,'$Muo')),lli1l1=require(llil1i(0x168,'4Tzx')),lii1l=require('crypto-js');let lii1i=[],lliIl='';if($[llil1i(0x17c,'hF1d')]()){Object[llil1i(0x299,'Ely]')](iiil1)['forEach'](I1Iiil=>{const IililI=llil1i;lii1i[IililI(0x4e0,'JO0$')](iiil1[I1Iiil]);});if(process['env'][llil1i(0x3a5,'cyaJ')]&&process[llil1i(0x4f7,'XPxd')][llil1i(0x27e,'4X5W')]===llil1i(0xa3,'8%$q'))console[llil1i(0x547,'ig7!')]=()=>{};}else lii1i=[$['getdata'](llil1i(0x455,'VNhG')),$[llil1i(0x3f3,'4Tzx')](llil1i(0x46f,'!Cf^')),...iiIlIi($[llil1i(0x33a,'xnVR')](llil1i(0x43f,'ig7!'))||'[]')[llil1i(0x1b5,'qcqg')](I1Iiii=>I1Iiii['cookie'])][llil1i(0x50b,'zvu2')](lIIliI=>!!lIIliI);let lliIi=process[llil1i(0x4e3,'n3Fj')]['jd_daily_activityUrl']?process[llil1i(0x4c1,'JO0$')][llil1i(0x121,'4Tzx')]:'',l1Iii1=process['env']['jd_daily_openCard']===llil1i(0x2df,'xnVR')?!![]:![],IIiIi1='';allMessage='',message='',$[llil1i(0x4fd,'IFxW')]=![],$[llil1i(0x273,'[uQD')]=![],$['activityEnd']=![];let I1i1='',iiiii='',iiiil={},iiIlII=process[llil1i(0x40f,'TwnU')]['JD_LZ_OPEN']?process['env']['JD_LZ_OPEN']:'true',il11II=process['env'][llil1i(0x41e,'vylO')]?process[llil1i(0x236,'[uQD')][llil1i(0x276,'p6fT')]:llil1i(0x1d1,'qN&m'),l11l1='',l11lI='';$[llil1i(0x463,'zvu2')]=process[llil1i(0x40f,'TwnU')]['jd_daily_whitelist']||l11l1,$[llil1i(0x345,'Ely]')]=process[llil1i(0x29d,'#@^o')]['jd_daily_blacklist']||l11lI,iiiiI(),ll1i();if(lliIi){const IiI111=llil1i(0xa0,'oNU0')[llil1i(0x31f,'n3Fj')]('|');let i11llI=0x0;while(!![]){switch(IiI111[i11llI++]){case'0':IIiIi1=iIlIli(''+lliIi,'activityId');continue;case'1':if($[llil1i(0x38f,'a3#[')][llil1i(0x419,'cyaJ')]('lzkj'))$[llil1i(0x14c,'xnVR')]=llil1i(0x386,'XPxd');continue;case'2':if($[llil1i(0x451,'l51Y')][llil1i(0x2f4,'l51Y')]('cjhy'))$['domain_mode']=llil1i(0x2de,'[uQD');continue;case'3':$[llil1i(0x495,'!Cf^')]=null;continue;case'4':if($[llil1i(0x531,'JO0$')]==null){console[llil1i(0x15a,'hF1d')]('请填写正确的活动链接');return;}continue;case'5':if(lliIi[llil1i(0x109,'Ely]')]('lzkj')){if(iiIlII===llil1i(0x1a6,'$Muo')){console[llil1i(0x306,'@JAS')](llil1i(0xd7,'@JAS'));return;}else $[llil1i(0x28d,'VNhG')]=lliIi[llil1i(0x365,'QZb7')](/https?:\/\/([^/]+)/)[0x1];}else{if(lliIi[llil1i(0x4e1,'@JAS')](llil1i(0x43b,'5Fiv'))){if(il11II==='false'){console[llil1i(0x25e,'vylO')](llil1i(0x32a,'XPxd'));return;}else $[llil1i(0x4d2,'K@H6')]=lliIi[llil1i(0x492,'f2L%')](/https?:\/\/([^/]+)/)[0x1];}}continue
// 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