KR/jd_drawShopGift.js

21 lines
40 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('店铺关注有礼')
var version_='jsjiami.com.v7';const _0x191825=_0x109a;function _0x109a(_0x57bc18,_0x2c3c14){const _0x470219=_0x4702();return _0x109a=function(_0x109a23,_0x4ec159){_0x109a23=_0x109a23-0x165;let _0xedcdee=_0x470219[_0x109a23];if(_0x109a['nfMtSb']===undefined){var _0x35ccd0=function(_0x57d216){const _0x258ced='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x383599='',_0x1ea604='';for(let _0x41e29c=0x0,_0x3d9ecc,_0x3ec70b,_0x4a359d=0x0;_0x3ec70b=_0x57d216['charAt'](_0x4a359d++);~_0x3ec70b&&(_0x3d9ecc=_0x41e29c%0x4?_0x3d9ecc*0x40+_0x3ec70b:_0x3ec70b,_0x41e29c++%0x4)?_0x383599+=String['fromCharCode'](0xff&_0x3d9ecc>>(-0x2*_0x41e29c&0x6)):0x0){_0x3ec70b=_0x258ced['indexOf'](_0x3ec70b);}for(let _0x4756c9=0x0,_0x203e03=_0x383599['length'];_0x4756c9<_0x203e03;_0x4756c9++){_0x1ea604+='%'+('00'+_0x383599['charCodeAt'](_0x4756c9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1ea604);};const _0x3a25d8=function(_0x8e1f6c,_0x420a71){let _0x4f17d8=[],_0x53b870=0x0,_0x492367,_0x30abb9='';_0x8e1f6c=_0x35ccd0(_0x8e1f6c);let _0x4ed2af;for(_0x4ed2af=0x0;_0x4ed2af<0x100;_0x4ed2af++){_0x4f17d8[_0x4ed2af]=_0x4ed2af;}for(_0x4ed2af=0x0;_0x4ed2af<0x100;_0x4ed2af++){_0x53b870=(_0x53b870+_0x4f17d8[_0x4ed2af]+_0x420a71['charCodeAt'](_0x4ed2af%_0x420a71['length']))%0x100,_0x492367=_0x4f17d8[_0x4ed2af],_0x4f17d8[_0x4ed2af]=_0x4f17d8[_0x53b870],_0x4f17d8[_0x53b870]=_0x492367;}_0x4ed2af=0x0,_0x53b870=0x0;for(let _0x172158=0x0;_0x172158<_0x8e1f6c['length'];_0x172158++){_0x4ed2af=(_0x4ed2af+0x1)%0x100,_0x53b870=(_0x53b870+_0x4f17d8[_0x4ed2af])%0x100,_0x492367=_0x4f17d8[_0x4ed2af],_0x4f17d8[_0x4ed2af]=_0x4f17d8[_0x53b870],_0x4f17d8[_0x53b870]=_0x492367,_0x30abb9+=String['fromCharCode'](_0x8e1f6c['charCodeAt'](_0x172158)^_0x4f17d8[(_0x4f17d8[_0x4ed2af]+_0x4f17d8[_0x53b870])%0x100]);}return _0x30abb9;};_0x109a['NVzOGE']=_0x3a25d8,_0x57bc18=arguments,_0x109a['nfMtSb']=!![];}const _0x1f6e9b=_0x470219[0x0],_0x4452b0=_0x109a23+_0x1f6e9b,_0x2ae4c2=_0x57bc18[_0x4452b0];return!_0x2ae4c2?(_0x109a['ewkGuI']===undefined&&(_0x109a['ewkGuI']=!![]),_0xedcdee=_0x109a['NVzOGE'](_0xedcdee,_0x4ec159),_0x57bc18[_0x4452b0]=_0xedcdee):_0xedcdee=_0x2ae4c2,_0xedcdee;},_0x109a(_0x57bc18,_0x2c3c14);}(function(_0x30a722,_0x22bcbb,_0x13bd7c,_0x36f030,_0x31080f,_0x183018,_0x4d31c7){return _0x30a722=_0x30a722>>0x2,_0x183018='hs',_0x4d31c7='hs',function(_0x1c7531,_0x5c2636,_0x2c4043,_0x3ee9b7,_0x250789){const _0xabf4c=_0x109a;_0x3ee9b7='tfi',_0x183018=_0x3ee9b7+_0x183018,_0x250789='up',_0x4d31c7+=_0x250789,_0x183018=_0x2c4043(_0x183018),_0x4d31c7=_0x2c4043(_0x4d31c7),_0x2c4043=0x0;const _0x2b031e=_0x1c7531();while(!![]&&--_0x36f030+_0x5c2636){try{_0x3ee9b7=-parseInt(_0xabf4c(0x1c1,'(de5'))/0x1+-parseInt(_0xabf4c(0x2a4,'Jz)!'))/0x2*(-parseInt(_0xabf4c(0x188,'Rg0p'))/0x3)+-parseInt(_0xabf4c(0x1d1,'%HKX'))/0x4*(parseInt(_0xabf4c(0x1b5,'sEZP'))/0x5)+parseInt(_0xabf4c(0x276,'fpQv'))/0x6*(-parseInt(_0xabf4c(0x1f0,'soPS'))/0x7)+-parseInt(_0xabf4c(0x272,'pdM)'))/0x8+parseInt(_0xabf4c(0x249,'R#zk'))/0x9+-parseInt(_0xabf4c(0x165,'Zp03'))/0xa*(-parseInt(_0xabf4c(0x26e,'^@zQ'))/0xb);}catch(_0x50c8d5){_0x3ee9b7=_0x2c4043;}finally{_0x250789=_0x2b031e[_0x183018]();if(_0x30a722<=_0x36f030)_0x2c4043?_0x31080f?_0x3ee9b7=_0x250789:_0x31080f=_0x250789:_0x2c4043=_0x250789;else{if(_0x2c4043==_0x31080f['replace'](/[ElQFMSdDRfXAGVHxKqy=]/g,'')){if(_0x3ee9b7===_0x5c2636){_0x2b031e['un'+_0x183018](_0x250789);break;}_0x2b031e[_0x4d31c7](_0x250789);}}}}}(_0x13bd7c,_0x22bcbb,function(_0x2587c1,_0x40da4b,_0x436b2f,_0x1c9455,_0x41819c,_0x204aa1,_0x18c596){return _0x40da4b='\x73\x70\x6c\x69\x74',_0x2587c1=arguments[0x0],_0x2587c1=_0x2587c1[_0x40da4b](''),_0x436b2f='\x72\x65\x76\x65\x72\x73\x65',_0x2587c1=_0x2587c1[_0x436b2f]('\x76'),_0x1c9455='\x6a\x6f\x69\x6e',(0x13ae59,_0x2587c1[_0x1c9455](''));});}(0x304,0x92471,_0x4702,0xc3),_0x4702)&&(version_=_0x4702);const _0x13aeb8=require(_0x191825(0x1ab,'q9XQ')),_0x2b2512=require('./function/sendJDNotify'),_0x2d7d45=require('./function/jdCommon'),_0x1b0444=require('./function/krgetSign'),_0x17ec00=process[_0x191825(0x1a1,'9211')][_0
// 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