KR/jd_daily.js

25 lines
88 KiB
JavaScript
Raw Normal View History

2023-07-27 16:14:01 +08:00
/*
活动名称每日抢好礼 · 超级无线/超级会员
2023-09-27 09:22:52 +08:00
活动链接https://lzkj-isv.isvjd.com/activity/daily/wx/indexPage?activityId=<活动id>
https://cjhy-isv.isvjcloud.com/activity/daily/wx/indexPage?activityId=<活动id>
环境变量jd_daily_activityUrl // 活动链接
jd_daily_joinMember // 是否开卡,默认不开卡
jd_daily_notify // 是否推送通知,默认不推送
jd_daily_blacklist 黑名单 &隔开 pin值
JD_LZ_OPEN // 是否开启LZ活动运行默认运行
JD_CJ_OPEN // 是否开启CJ活动运行默认运行
jd_daily_break // 493后继续执行默认退出运行true/false
2023-07-27 16:14:01 +08:00
cron:1 1 1 1 *
============Quantumultx===============
[task_local]
2023-09-27 09:22:52 +08:00
#每日抢好礼通用活动
1 1 1 1 * jd_daily.js, tag=每日抢好礼通用活动, enabled=true
2023-07-27 16:14:01 +08:00
*/
const $ = new Env('每日抢好礼(超级无线/超级会员)')
2023-09-27 09:22:52 +08:00
var version_='jsjiami.com.v7';const iIiIiill=I11ll1li;(function(IIiliii1,l11Ill1l,IliiIlll,IIii1iil,iil1I1ll,lI1iIl1,Ii1lllll){return IIiliii1=IIiliii1>>0x3,lI1iIl1='hs',Ii1lllll='hs',function(I11I111I,lIIIIIiI,Il11111i,lI1illIi,llilll11){const illIl1ii=I11ll1li;lI1illIi='tfi',lI1iIl1=lI1illIi+lI1iIl1,llilll11='up',Ii1lllll+=llilll11,lI1iIl1=Il11111i(lI1iIl1),Ii1lllll=Il11111i(Ii1lllll),Il11111i=0x0;const il1I111i=I11I111I();while(!![]&&--IIii1iil+lIIIIIiI){try{lI1illIi=parseInt(illIl1ii(0x424,'Exl1'))/0x1*(-parseInt(illIl1ii(0x234,'C3Fr'))/0x2)+-parseInt(illIl1ii(0x4d2,')!Jd'))/0x3+-parseInt(illIl1ii(0x330,'@Ls0'))/0x4*(parseInt(illIl1ii(0x405,'TeQs'))/0x5)+parseInt(illIl1ii(0x321,'*wVk'))/0x6+-parseInt(illIl1ii(0x467,'%cDj'))/0x7*(parseInt(illIl1ii(0x441,'0jhT'))/0x8)+parseInt(illIl1ii(0x297,'Exl1'))/0x9+parseInt(illIl1ii(0x4b1,'2PPs'))/0xa;}catch(i1iii11I){lI1illIi=Il11111i;}finally{llilll11=il1I111i[lI1iIl1]();if(IIiliii1<=IIii1iil)Il11111i?iil1I1ll?lI1illIi=llilll11:iil1I1ll=llilll11:Il11111i=llilll11;else{if(Il11111i==iil1I1ll['replace'](/[DIKlRkywtMgnfxeXPTp=]/g,'')){if(lI1illIi===lIIIIIiI){il1I111i['un'+lI1iIl1](llilll11);break;}il1I111i[Ii1lllll](llilll11);}}}}}(IliiIlll,l11Ill1l,function(ll111Il,i11iil11,lliIi11i,IlIiilII,II11ii1,I11iI1ii,ilII1I1){return i11iil11='\x73\x70\x6c\x69\x74',ll111Il=arguments[0x0],ll111Il=ll111Il[i11iil11](''),lliIi11i=`\x72\x65\x76\x65\x72\x73\x65`,ll111Il=ll111Il[lliIi11i]('\x76'),IlIiilII=`\x6a\x6f\x69\x6e`,(0x1401f6,ll111Il[IlIiilII](''));});}(0x630,0xd3d8b,I1ll1lII,0xc8),I1ll1lII)&&(version_=I1ll1lII);const I1iIi1lI=$[iIiIiill(0x3a0,'Qn1Y')]()?require(iIiIiill(0x440,'P*EX')):'',i111li1=require(iIiIiill(0x444,'P*EX')),lii1iil1=require(iIiIiill(0x392,'(iNC')),iIill1=require(iIiIiill(0x29d,'mc54')),{wuxian_savePrize:lI1l1li1}=require('./function/krsavePrize'),IIIi1lIl=require(iIiIiill(0x3c8,'zcj5'));let i1liil1l=[];const il11IiI=process['env'][iIiIiill(0x2cf,'MhcU')]||'',iII1II1I=process[iIiIiill(0x271,'NnUH')]['jd_daily_joinMember']===iIiIiill(0x23b,'fQuv'),lIll1iI=process[iIiIiill(0x35e,'Zo@n')][iIiIiill(0x35c,'FY]$')]==='true';let lI1llIli='',IIill1i='',i11l1i11='';if($['isNode']()){if(JSON[iIiIiill(0x298,'had[')](process[iIiIiill(0x4a6,'C3Fr')])[iIiIiill(0x2e9,'Qn1Y')](iIiIiill(0x4d4,'NnUH'))>-0x1)process[iIiIiill(0x540,'4YP@')](0x0);Object[iIiIiill(0x315,'(iNC')](I1iIi1lI)[iIiIiill(0x515,'zcj5')](I1iI1l11=>{const lllliill=iIiIiill;i1liil1l[lllliill(0x52c,'SQ5c')](I1iIi1lI[I1iI1l11]);});if(process[iIiIiill(0x510,'0jhT')]['JD_DEBUG']&&process[iIiIiill(0x290,'*7p@')][iIiIiill(0x1f0,'H%FM')]===iIiIiill(0x2d3,'r1t^'))console[iIiIiill(0x25c,'C2ga')]=()=>{};}else i1liil1l=[$[iIiIiill(0x2e3,')!Jd')](iIiIiill(0x454,'OiZ7')),$[iIiIiill(0x3c0,')wjh')]('CookieJD2'),...$[iIiIiill(0x348,'C3Fr')]($[iIiIiill(0x457,'had[')](iIiIiill(0x1dd,'NV0l'))||'[]')[iIiIiill(0x295,'mc54')](liI11il1=>liI11il1['cookie'])][iIiIiill(0x4e0,')wjh')](iliIii1l=>!!iliIii1l);!i1liil1l[0x0]&&($[iIiIiill(0x2b7,'a[0U')]($[iIiIiill(0x31a,'@DXf')],iIiIiill(0x408,'4YP@')),process['exit'](0x1));const i1IIlll=process['env'][iIiIiill(0x521,'OiZ7')]===iIiIiill(0x485,'a[0U');let IIllI1l1=process[iIiIiill(0x359,'9Aqj')][iIiIiill(0x584,'1#zX')]?process[iIiIiill(0x4cf,'GLcw')]['JD_LZ_OPEN']:iIiIiill(0x1fb,'Wo[t'),iIliili=process[iIiIiill(0x2a4,'P*EX')][iIiIiill(0x206,'5RNL')]?process[iIiIiill(0x4f5,'mc54')][iIiIiill(0x206,'5RNL')]:iIiIiill(0x51c,'*pIk'),IlI1iilI='',liill1ll='';$[iIiIiill(0x48b,'C3Fr')]=process[iIiIiill(0x3fa,'LkOE')][iIiIiill(0x306,'NnUH')]||IlI1iilI,$[iIiIiill(0x543,'0jhT')]=process[iIiIiill(0x32c,'@DXf')][iIiIiill(0x27f,'(iNC')]||liill1ll,Ili11i11(),lIII11I1(),!(async()=>{const IiiIli1l=iIiIiill,iil1I1={'wCzHY':IiiIli1l(0x395,'2PPs'),'sMDHb':'⚠\x20请填写格式正确的链接','ySgbo':IiiIli1l(0x1fe,'*wVk'),'nXIXQ':IiiIli1l(0x2f9,')wjh'),'rJFDG':function(IiliIllI,IiIIi1){return IiliIllI===IiIIi1;},'dsxNb':'Ptthu','EZuYy':function(IlIIIi1l,I11ilill){return IlIIIi1l===I11ilill;},'CGPKs':IiiIli1l(0x36c,')!Jd'),'xspCp':IiiIli1l(0x1d8,'P*EX'),'rKlSp':function(IIi1l1i1,IIi1Il){return IIi1l1i1!==IIi1Il;},'KnBfm'
2023-07-27 16:14:01 +08:00
// prettier-ignore
2023-09-27 09:22:52 +08:00
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"])