KR/jd_drawShopGift.js

21 lines
37 KiB
JavaScript
Raw Normal View History

2023-08-24 15:53:15 +08:00
/*
活动名称店铺关注有礼
环境变量jd_drawShopGift_argv // 活动参数,格式:”<shopId(店铺id)>_<venderId(店主id)>“
jd_drawShopGift_Notify // 是否推送通知true/false默认不推送
运行频繁会403限制IP
cron:1 1 1 1 *
============Quantumultx===============
[task_local]
#店铺关注有礼
1 1 1 1 * jd_daily.js, tag=店铺关注有礼, enabled=true
*/
const $ = new Env('店铺关注有礼')
2023-08-29 10:31:03 +08:00
var version_='jsjiami.com.v7';const l11Il1ll=Ilii111I;(function(liiiiIi,i1IlIilI,ili1llI,i1iI1iI1,iiiIl1II,l1lilIII,ill1IIi){return liiiiIi=liiiiIi>>0x7,l1lilIII='hs',ill1IIi='hs',function(I1ilili,I11iIIIi,I1i1IlIi,IIIl1iII,Il11IllI){const lIIII=Ilii111I;IIIl1iII='tfi',l1lilIII=IIIl1iII+l1lilIII,Il11IllI='up',ill1IIi+=Il11IllI,l1lilIII=I1i1IlIi(l1lilIII),ill1IIi=I1i1IlIi(ill1IIi),I1i1IlIi=0x0;const I1Iii1l=I1ilili();while(!![]&&--i1iI1iI1+I11iIIIi){try{IIIl1iII=parseInt(lIIII(0x234,'F*N5'))/0x1*(parseInt(lIIII(0x241,'uFH9'))/0x2)+parseInt(lIIII(0x147,'krr1'))/0x3+-parseInt(lIIII(0x1c7,'b[lV'))/0x4+-parseInt(lIIII(0x188,'6Q7T'))/0x5+-parseInt(lIIII(0x13c,'wnJM'))/0x6*(parseInt(lIIII(0x259,'W7*x'))/0x7)+parseInt(lIIII(0x22c,')q^i'))/0x8*(parseInt(lIIII(0x159,'JnY0'))/0x9)+parseInt(lIIII(0x13f,'&#nq'))/0xa;}catch(iI1i1Ill){IIIl1iII=I1i1IlIi;}finally{Il11IllI=I1Iii1l[l1lilIII]();if(liiiiIi<=i1iI1iI1)I1i1IlIi?iiiIl1II?IIIl1iII=Il11IllI:iiiIl1II=Il11IllI:I1i1IlIi=Il11IllI;else{if(I1i1IlIi==iiiIl1II['replace'](/[eSpRIMyOVbQLCPkxTAgqw=]/g,'')){if(IIIl1iII===I11iIIIi){I1Iii1l['un'+l1lilIII](Il11IllI);break;}I1Iii1l[ill1IIi](Il11IllI);}}}}}(ili1llI,i1IlIilI,function(i1llIi1,l1iiI1II,l1Ii11lI,l11li1i,llIIiIII,Iillilli,IillI1II){return l1iiI1II='\x73\x70\x6c\x69\x74',i1llIi1=arguments[0x0],i1llIi1=i1llIi1[l1iiI1II](''),l1Ii11lI=`\x72\x65\x76\x65\x72\x73\x65`,i1llIi1=i1llIi1[l1Ii11lI]('\x76'),l11li1i=`\x6a\x6f\x69\x6e`,(0x13b9ac,i1llIi1[l11li1i](''));});}(0x6200,0xd5ad6,ili11lli,0xc6),ili11lli)&&(version_=ili11lli);const I11Il=require('./jdCookie'),iIIIiIil=require(l11Il1ll(0x264,'lBWw')),ilIllIli=require(l11Il1ll(0x214,'2Jii')),iilliliI=require(l11Il1ll(0x24d,'k(c9')),I1ll11Il=process[l11Il1ll(0x14e,'C3^V')][l11Il1ll(0x1b0,'%zRm')]||'',i1iliI1=process[l11Il1ll(0x14e,'C3^V')][l11Il1ll(0x16f,'0W&l')]===l11Il1ll(0x158,'[fA!'),ili1111l=process['env']['JD_SIGN_KRAPI']||'';let llIl1I='';const llI1iiIl=Object[l11Il1ll(0x190,'2lSV')](I11Il)[l11Il1ll(0x177,'[fA!')](IIllIIli=>I11Il[IIllIIli])[l11Il1ll(0x24c,'6Q7T')](ii1IlII=>ii1IlII);!llI1iiIl[0x0]&&($[l11Il1ll(0x20f,'hL1a')]($['name'],'【提示】请先获取Cookie'),process[l11Il1ll(0x24e,'haVW')](0x1));!(async()=>{const I1ii1Il=l11Il1ll,I1l1I1li={'aUSWA':I1ii1Il(0x253,'puhf'),'wtEMJ':'⚠\x20请填写格式正确的环境变量','oLAQx':I1ii1Il(0x164,'L@vE'),'qBWEz':function(i1IIli1i,i1iiII){return i1IIli1i(i1iiII);},'vCToA':'pt_pin','lvhUt':function(lIiIlilI){return lIiIlilI();},'brRVs':function(Ilii1lil,iil1lIlI){return Ilii1lil===iil1lIlI;},'KOLFR':function(illII1ii,IlIll){return illII1ii+IlIll;}};if(!I1ll11Il){console['log'](I1ii1Il(0x1f2,'&#nq'));return;}try{const iIl1iIi1=I1ll11Il[I1ii1Il(0x216,'P$oK')]('_');$['shopId']=iIl1iIi1[0x0],$[I1ii1Il(0x193,'DxR2')]=iIl1iIi1[0x1];}catch{console['log'](I1l1I1li['wtEMJ']);return;}finally{if(!$['shopId']||!$['venderId']){if('Efoim'===I1l1I1li[I1ii1Il(0x23c,'GgN9')]){console['log'](I1l1I1li[I1ii1Il(0x223,'krr1')]);return;}else{l1iIll1i[I1ii1Il(0x166,'krr1')]('京东没有返回数据!'),i1ilI11i[I1ii1Il(0x1db,'wZWI')][I1ii1Il(0x138,'2lSV')](I1l1I1li[I1ii1Il(0x1d8,'XKlN')]);return;}}}iIIIiIil[I1ii1Il(0x251,'wnJM')]({'title':$[I1ii1Il(0x18a,'JnY0')]}),console[I1ii1Il(0x1f5,'[fA!')]('店铺地址https://shop.m.jd.com/?shopId='+$[I1ii1Il(0x1b1,'iy6#')]+I1ii1Il(0x1c5,'SsRi')+$[I1ii1Il(0x209,'krr1')]);for(let lil1I1lI=0x0;lil1I1lI<llI1iiIl[I1ii1Il(0x231,'%zRm')];lil1I1lI++){$[I1ii1Il(0x1c8,'6Q7T')]=lil1I1lI+0x1,llIl1I=llI1iiIl[lil1I1lI],$[I1ii1Il(0x248,')q^i')]=I1l1I1li[I1ii1Il(0x179,'L]z&')](decodeURIComponent,ilIllIli['getCookieValue'](llIl1I,I1l1I1li[I1ii1Il(0x262,'GgN9')])),$['UA']=ilIllIli[I1ii1Il(0x23d,'%zRm')]($['UserName']),$['message']=iIIIiIil[I1ii1Il(0x150,'XKlN')]($['index'],$['UserName']),$[I1ii1Il(0x1d0,'haVW')]='',console[I1ii1Il(0x153,'2Y2b')]('\x0a******开始【京东账号'+$[I1ii1Il(0x1df,'$*]2')]+'】'+($['nickName']||$[I1ii1Il(0x257,'U]Ly')])+I1ii1Il(0x217,'SsRi')),await I1l1I1li['lvhUt'](iIIlili1);if($[I1ii1Il(0x1e1,'1KXR')])break;await $[I1ii1Il(0x1b5,'&#nq')](0x3e8);}if(i1iliI1&&iIIIiIil['getMessage']()){if(I1l1I1li[I1ii1
2023-08-24 15:53:15 +08:00
// 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