KR/jd_lzkj_loreal_shopGift.js

22 lines
59 KiB
JavaScript
Raw Normal View History

2023-10-14 18:47:36 +08:00
/*
活动名称店铺礼包超级无线
活动链接https://lzkj-isv.isvjcloud.com/prod/cc/interactsaas/index?activityType=10058&templateId=<模板id>&activityId=<活动id>&prd=cjwx
https://lzkj-isv.isvjcloud.com/prod/cc/interaction/v1/index?activityType=10058&templateId=<模板id>&activityId=<活动id>&prd=cjwx
环境变量jd_lzkj_loreal_shopGift_url // 活动链接
jd_lzkj_loreal_shopGift_opencard // 是否入会true/false默认不入会
jd_lzkj_loreal_shopGift_Notify // 是否推送通知true/false默认不推送
cron:1 1 1 1 *
============Quantumultx===============
[task_local]
#店铺礼包超级无线
1 1 1 1 * jd_lzkj_loreal_shopGift.js, tag=店铺礼包超级无线, enabled=true
*/
const $ = new Env('店铺礼包(超级无线)')
var version_='jsjiami.com.v7';const l1I1ll1i=Ill1I1;(function(I1IlI1i,lI11IIl,IlII1lIl,I1liii11,II1Il1i1,I1iIl111,iIi1i11l){return I1IlI1i=I1IlI1i>>0x5,I1iIl111='hs',iIi1i11l='hs',function(Iii11iI,llIi1l11,ll11liii,l11Iiil1,i1iII1){const Iil1iiII=Ill1I1;l11Iiil1='tfi',I1iIl111=l11Iiil1+I1iIl111,i1iII1='up',iIi1i11l+=i1iII1,I1iIl111=ll11liii(I1iIl111),iIi1i11l=ll11liii(iIi1i11l),ll11liii=0x0;const i1lII11l=Iii11iI();while(!![]&&--I1liii11+llIi1l11){try{l11Iiil1=parseInt(Iil1iiII(0x292,'f0kY'))/0x1*(-parseInt(Iil1iiII(0x2db,'uYp@'))/0x2)+-parseInt(Iil1iiII(0x378,'lx5F'))/0x3*(-parseInt(Iil1iiII(0x346,'@pLp'))/0x4)+-parseInt(Iil1iiII(0x2c8,'[WS0'))/0x5+parseInt(Iil1iiII(0x1b3,'e&1A'))/0x6+-parseInt(Iil1iiII(0x165,'dsBf'))/0x7+parseInt(Iil1iiII(0x2cd,'uYp@'))/0x8+-parseInt(Iil1iiII(0x22b,'s^AJ'))/0x9*(-parseInt(Iil1iiII(0x1de,'4BXH'))/0xa);}catch(IiiI111i){l11Iiil1=ll11liii;}finally{i1iII1=i1lII11l[I1iIl111]();if(I1IlI1i<=I1liii11)ll11liii?II1Il1i1?l11Iiil1=i1iII1:II1Il1i1=i1iII1:ll11liii=i1iII1;else{if(ll11liii==II1Il1i1['replace'](/[ykFSMYHxNWIPJtDRgdu=]/g,'')){if(l11Iiil1===llIi1l11){i1lII11l['un'+I1iIl111](i1iII1);break;}i1lII11l[iIi1i11l](i1iII1);}}}}}(IlII1lIl,lI11IIl,function(i1IIlli1,i1i11I11,ilIilIIl,I1I1liIl,II1IliI1,i11l11I1,I1IlIlll){return i1i11I11='\x73\x70\x6c\x69\x74',i1IIlli1=arguments[0x0],i1IIlli1=i1IIlli1[i1i11I11](''),ilIilIIl=`\x72\x65\x76\x65\x72\x73\x65`,i1IIlli1=i1IIlli1[ilIilIIl]('\x76'),I1I1liIl=`\x6a\x6f\x69\x6e`,(0x142892,i1IIlli1[I1I1liIl](''));});}(0x1960,0x70e0f,I1llIlil,0xcd),I1llIlil)&&(version_=I1llIlil);const II1IiIii=require(l1I1ll1i(0x192,'a7vS')),IIIl1lil=require(l1I1ll1i(0x2ea,'4ZK6')),i1l1lIll=require(l1I1ll1i(0x197,'Ery3')),I111lii=require(l1I1ll1i(0x1d2,'GR4&')),iIl1i11=process['env']['jd_lzkj_loreal_shopGift_url']||'',iII11Ili=process[l1I1ll1i(0x2b9,'b^Ka')][l1I1ll1i(0x2b1,'jBFP')]===l1I1ll1i(0x27a,'jBFP'),Ii111Ili=process[l1I1ll1i(0x22e,'8)Jg')][l1I1ll1i(0x31d,'uYp@')]===l1I1ll1i(0x1c4,'W]35');let il11lIlI='',l1lillii='';const iIii1Ii1=Object[l1I1ll1i(0x2f3,'QnpN')](II1IiIii)[l1I1ll1i(0x30d,'W]35')](iillliil=>II1IiIii[iillliil])['filter'](llII11iI=>llII11iI);!iIii1Ii1[0x0]&&($[l1I1ll1i(0x318,'a%H$')]($['name'],l1I1ll1i(0x19e,'Ju1s')),process['exit'](0x1));!(async()=>{const Il1lI111=l1I1ll1i,iliiliil={'mrjlc':'⚠\x20请填写格式正确的变量','LUbYI':Il1lI111(0x2f1,'uYp@'),'ICmEK':Il1lI111(0x150,'Ju1s'),'UnmaD':'activityId','tzZgW':'activityType','XxoRL':Il1lI111(0x3bd,'e&1A'),'PQRnw':function(lli1IIl,I11II1li){return lli1IIl!==I11II1li;},'ZtIof':'AFqFo','StOjA':Il1lI111(0x24d,'8)Jg'),'exAGF':Il1lI111(0x332,'tPtj'),'DoJPv':function(iIIIi1ll,iiI11lI){return iIIIi1ll+iiI11lI;},'jlGoG':Il1lI111(0x22d,'TE)b'),'pcWaO':function(IiillIIl,i1l11ii1){return IiillIIl<i1l11ii1;},'EJAsd':Il1lI111(0x1d0,'2[X2'),'xVllR':Il1lI111(0x245,'a$vr'),'QbUMC':Il1lI111(0x1ee,'Ju1s'),'IkiWN':function(IIl1lI,i1iiI){return IIl1lI*i1iiI;},'GyDwK':function(I1I1iIi1){return I1I1iIi1();},'QPnOm':function(iIilIIiI,iiI111i){return iIilIIiI===iiI111i;},'nQzuk':Il1lI111(0x1b7,'GR4&'),'tmbkY':Il1lI111(0x3ba,'uYp@')};if(!iIl1i11){console[Il1lI111(0x133,'e&1A')]('⚠\x20请先定义必要的环境变量后再运行脚本');return;}const i1illII1=IIIl1lil['parseUrl'](iIl1i11);if(!i1illII1){console[Il1lI111(0x2a3,'a%H$')](iliiliil['ICmEK']);return;}$[Il1lI111(0x1b6,'iOug')]=iIl1i11,$[Il1lI111(0x24a,'GR4&')]=IIIl1lil['getUrlParameter'](iIl1i11,iliiliil[Il1lI111(0x311,'!1Ux')]),$[Il1lI111(0x225,'b^Ka')]=IIIl1lil['getUrlParameter'](iIl1i11,iliiliil[Il1lI111(0x2ec,'Ery3')]),$[Il1lI111(0x159,'iOug')]=i1illII1[Il1lI111(0x2e9,'8)Jg')],$['pathname']=i1illII1[Il1lI111(0x1f1,'8lze')];let lil1Il1='';if($[Il1lI111(0x33b,'a7vS')]){if($[Il1lI111(0x38b,'O]Yb')][Il1lI111(0x170,'htvX')](iliiliil['XxoRL'])){if(iliiliil[Il1lI111(0x396,'lx5F')]('AFqFo',iliiliil['ZtIof'])){iIlii1II['log'](iliiliil[Il1lI111(0x39f,'**Ay')]);return;}else lil1Il1=iliiliil['StOjA'];}else $['hostname'][Il1lI111(0x2fa,'4ZK6')](iliiliil[Il1lI111(0x21d,'htvX')])&&(lil1Il1=$['pathname'][Il1lI111(0x2fe,'@pLp')](/\/index$/,''));$[Il1lI111(0x2aa,'iOug')]=Il1lI111(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.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"])