KR/jd_jinggeng_showCart.js

21 lines
77 KiB
JavaScript
Raw Normal View History

2023-07-28 10:10:43 +08:00
/*
活动名称加购有礼 · 京耕
活动链接https://jinggeng-isv.isvjcloud.com/ql/front/showCart?id=<活动id>&user_id=<店铺id>
环境变量jd_jinggeng_showCart_activityUrl // 活动链接
请使用本地IP环境 请使用本地IP环境 请使用本地IP环境
cron:1 1 1 1 *
============Quantumultx===============
[task_local]
#加购有礼
1 1 1 1 * jd_jinggeng_showCart.js, tag=加购有礼, enabled=true
*/
const $ = new Env('加购有礼(京耕)')
var version_='jsjiami.com.v7';const lIi1Ii=iii1II;(function(liIIIl,iliil1,i1i1ll,IIllI1,lIl1iI,iil1II,iii11I){return liIIIl=liIIIl>>0x6,iil1II='hs',iii11I='hs',function(IIil11,iI11iI,l1IliI,liIIIi,iIilI){const l1IllI=iii1II;liIIIi='tfi',iil1II=liIIIi+iil1II,iIilI='up',iii11I+=iIilI,iil1II=l1IliI(iil1II),iii11I=l1IliI(iii11I),l1IliI=0x0;const liii=IIil11();while(!![]&&--IIllI1+iI11iI){try{liIIIi=parseInt(l1IllI(0xf5,'ee#]'))/0x1+-parseInt(l1IllI(0x275,'PRtu'))/0x2+parseInt(l1IllI(0x281,'JmAS'))/0x3+parseInt(l1IllI(0x277,'cz2c'))/0x4+parseInt(l1IllI(0x30b,'TX!4'))/0x5*(-parseInt(l1IllI(0x25d,'a(MH'))/0x6)+parseInt(l1IllI(0x295,'[!(l'))/0x7*(-parseInt(l1IllI(0x297,'97x2'))/0x8)+parseInt(l1IllI(0x3b0,'TVk)'))/0x9;}catch(iliilI){liIIIi=l1IliI;}finally{iIilI=liii[iil1II]();if(liIIIl<=IIllI1)l1IliI?lIl1iI?liIIIi=iIilI:lIl1iI=iIilI:l1IliI=iIilI;else{if(l1IliI==lIl1iI['replace'](/[eEWUXthNPSwdRgGVnDMfJ=]/g,'')){if(liIIIi===iI11iI){liii['un'+iil1II](iIilI);break;}liii[iii11I](iIilI);}}}}}(i1i1ll,iliil1,function(I111iI,IlIlI,IIil1I,II1i1l,II1i1i,Il1iiI,iIil1){return IlIlI='\x73\x70\x6c\x69\x74',I111iI=arguments[0x0],I111iI=I111iI[IlIlI](''),IIil1I='\x72\x65\x76\x65\x72\x73\x65',I111iI=I111iI[IIil1I]('\x76'),II1i1l='\x6a\x6f\x69\x6e',(0x136897,I111iI[II1i1l](''));});}(0x3340,0x7d10d,Iii11l,0xcf),Iii11l)&&(version_=Iii11l);const iiil1l=$[lIi1Ii(0x14c,']2zo')]()?require('./sendNotify'):'',Il1l=$[lIi1Ii(0x100,'mkf4')]()?require('./jdCookie'):'',ll11I1=require('./function/krgetToken'),Illll=require(lIi1Ii(0x2d0,'c!)V')),iiil1i=require(lIi1Ii(0x14e,')RKO'));function iii1II(_0x3e7351,_0x35e1fb){const _0x11dd55=Iii11l();return iii1II=function(_0x1513c0,_0x5c80b6){_0x1513c0=_0x1513c0-0xb5;let _0x24ce5b=_0x11dd55[_0x1513c0];if(iii1II['HsiqGi']===undefined){var _0x559ced=function(_0x48576d){const _0x48868b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x51737e='',_0x58a871='';for(let _0x25e30b=0x0,_0x40855f,_0x34a73c,_0x539096=0x0;_0x34a73c=_0x48576d['charAt'](_0x539096++);~_0x34a73c&&(_0x40855f=_0x25e30b%0x4?_0x40855f*0x40+_0x34a73c:_0x34a73c,_0x25e30b++%0x4)?_0x51737e+=String['fromCharCode'](0xff&_0x40855f>>(-0x2*_0x25e30b&0x6)):0x0){_0x34a73c=_0x48868b['indexOf'](_0x34a73c);}for(let _0x4e1f59=0x0,_0x1ff067=_0x51737e['length'];_0x4e1f59<_0x1ff067;_0x4e1f59++){_0x58a871+='%'+('00'+_0x51737e['charCodeAt'](_0x4e1f59)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x58a871);};const _0x2b8265=function(_0x3b4e08,_0x2aa00b){let _0x20eddd=[],_0xbb549b=0x0,_0x4de45e,_0x21ce00='';_0x3b4e08=_0x559ced(_0x3b4e08);let _0x38c9ad;for(_0x38c9ad=0x0;_0x38c9ad<0x100;_0x38c9ad++){_0x20eddd[_0x38c9ad]=_0x38c9ad;}for(_0x38c9ad=0x0;_0x38c9ad<0x100;_0x38c9ad++){_0xbb549b=(_0xbb549b+_0x20eddd[_0x38c9ad]+_0x2aa00b['charCodeAt'](_0x38c9ad%_0x2aa00b['length']))%0x100,_0x4de45e=_0x20eddd[_0x38c9ad],_0x20eddd[_0x38c9ad]=_0x20eddd[_0xbb549b],_0x20eddd[_0xbb549b]=_0x4de45e;}_0x38c9ad=0x0,_0xbb549b=0x0;for(let _0x917b18=0x0;_0x917b18<_0x3b4e08['length'];_0x917b18++){_0x38c9ad=(_0x38c9ad+0x1)%0x100,_0xbb549b=(_0xbb549b+_0x20eddd[_0x38c9ad])%0x100,_0x4de45e=_0x20eddd[_0x38c9ad],_0x20eddd[_0x38c9ad]=_0x20eddd[_0xbb549b],_0x20eddd[_0xbb549b]=_0x4de45e,_0x21ce00+=String['fromCharCode'](_0x3b4e08['charCodeAt'](_0x917b18)^_0x20eddd[(_0x20eddd[_0x38c9ad]+_0x20eddd[_0xbb549b])%0x100]);}return _0x21ce00;};iii1II['dqgQNo']=_0x2b8265,_0x3e7351=arguments,iii1II['HsiqGi']=!![];}const _0x1f7d55=_0x11dd55[0x0],_0x5c636a=_0x1513c0+_0x1f7d55,_0x36943d=_0x3e7351[_0x5c636a];return!_0x36943d?(iii1II['UhpboM']===undefined&&(iii1II['UhpboM']=!![]),_0x24ce5b=iii1II['dqgQNo'](_0x24ce5b,_0x5c80b6),_0x3e7351[_0x5c636a]=_0x24ce5b):_0x24ce5b=_0x36943d,_0x24ce5b;},iii1II(_0x3e7351,_0x35e1fb);}let ilIIli={},ilIIll='',iIliil='',IIiill=[];$['activityEnd']=![];let liIIii=0x2,Iii1lI=![],I1liii=[],liiiIi='',l1I11I='',I1liil='';if($[lIi1Ii(0x267,'BP0z')]()){if(process[lIi1Ii(0x190,'xJVF')][lIi1Ii(0x3ec,'3rba')])activityUrl=process['env']['jd_jinggeng_showCart_activityUrl'];if(JSON[lIi1Ii(0x3b7,'TVk)')](process[lIi1Ii(0x332,'cu*M')])[lIi1Ii(0x238,'TVk)')](lIi1Ii(0x399
// 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.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"])