jdpro/jd_dpqd_sign.js

27 lines
42 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
活动名称批量店铺签到
活动链接https://h5.m.jd.com/babelDiy/Zeus/2PAAf74aG3D61qvfKUM5dxUssJQ9/index.html?token=<token>
环境变量jd_dpqd_tokens // 活动令牌,多个用英文逗号分割
jd_dpqd_task_threads // 控制签到并发线程数正整数默认1
jd_dpqd_account_threads // 控制账号并发线程数正整数默认1
jd_dpqd_account_interval // 自定义运行间隔时长整数单位毫秒默认0
jd_dpqd_max_retry // 签到火爆时的最大重试次数整数默认0
jd_dpqd_prize_notify // 是否推送中奖信息true/false默认不推送
此脚本为高并发签到本需要读取主脚本生成的活动信息缓存自动过滤无效活动
58 59 23 * * * jd_dpqd_sign.js
*/
const $ = new Env('批量店铺签到')
const jdCookie = require('./jdCookie')
const notify = require('./function/sendJDNotify')
const common = require('./function/jdCommon')
const { H5st, jsTk } = require('./function/jdCrypto')
var il='jsjiami.com.v7';const iiiil111=lIi1iiiI;(function(i1lIl1l,ll1l1Ili,ilIII11l,iiIII1li,IllIllI,IIli11Ii,ill1lli1){return i1lIl1l=i1lIl1l>>0x3,IIli11Ii='hs',ill1lli1='hs',function(li1Ii1ll,lIilii1i,I1Iliii,lIl1III,ii1Illl){const liIlilIi=lIi1iiiI;lIl1III='tfi',IIli11Ii=lIl1III+IIli11Ii,ii1Illl='up',ill1lli1+=ii1Illl,IIli11Ii=I1Iliii(IIli11Ii),ill1lli1=I1Iliii(ill1lli1),I1Iliii=0x0;const il1i1l1i=li1Ii1ll();while(!![]&&--iiIII1li+lIilii1i){try{lIl1III=-parseInt(liIlilIi(0x125,'oI%*'))/0x1+parseInt(liIlilIi(0x122,'RLMB'))/0x2+-parseInt(liIlilIi(0x240,'#P4h'))/0x3*(parseInt(liIlilIi(0x16e,'#R^N'))/0x4)+parseInt(liIlilIi(0xf4,'wJ9['))/0x5*(-parseInt(liIlilIi(0x233,'Y&r#'))/0x6)+-parseInt(liIlilIi(0x21a,'Io)u'))/0x7+-parseInt(liIlilIi(0x210,'B]cG'))/0x8+-parseInt(liIlilIi(0x10b,'Q3^E'))/0x9*(-parseInt(liIlilIi(0x1cc,'3A)X'))/0xa);}catch(il1lI1ll){lIl1III=I1Iliii;}finally{ii1Illl=il1i1l1i[IIli11Ii]();if(i1lIl1l<=iiIII1li)I1Iliii?IllIllI?lIl1III=ii1Illl:IllIllI=ii1Illl:I1Iliii=ii1Illl;else{if(I1Iliii==IllIllI['replace'](/[ASeJhkYlKrfQGIxqRH=]/g,'')){if(lIl1III===lIilii1i){il1i1l1i['un'+IIli11Ii](ii1Illl);break;}il1i1l1i[ill1lli1](ii1Illl);}}}}}(ilIII11l,ll1l1Ili,function(liIi111,li1illil,iiillIl1,iIII11I,liliii11,i1lIIli,iIlil1I){return li1illil='\x73\x70\x6c\x69\x74',liIi111=arguments[0x0],liIi111=liIi111[li1illil](''),iiillIl1=`\x72\x65\x76\x65\x72\x73\x65`,liIi111=liIi111[iiillIl1]('\x76'),iIII11I=`\x6a\x6f\x69\x6e`,(0x15e9d8,liIi111[iIII11I](''));});}(0x620,0x668de,iillIIlI,0xc6),iillIIlI)&&(il=iiiil111(0xff,'ATwe'));let tokensList=(process[iiiil111(0xac,'Io)u')][iiiil111(0x1a5,'3A)X')]||'')[iiiil111(0x163,'#P4h')](/,|@|&/)||[],taskThreads=process[iiiil111(0x132,'ZC*B')][iiiil111(0x234,'Io)u')]||'1',accountThreads=process[iiiil111(0x1df,'Czf)')][iiiil111(0xcf,'pM(^')]||'1';const runInterval=process[iiiil111(0x1a9,'RLMB')][iiiil111(0x231,'B]cG')]||'';let signHotMaxRetryTimes=process[iiiil111(0x149,'#P4h')][iiiil111(0x106,'C6fu')]||'0';function lIi1iiiI(_0x553eaa,_0x57eda4){const _0x58dab8=iillIIlI();return lIi1iiiI=function(_0x1b8965,_0x5e12ba){_0x1b8965=_0x1b8965-0xa0;let _0x15f6d4=_0x58dab8[_0x1b8965];if(lIi1iiiI['TjbESS']===undefined){var _0x830fd0=function(_0x53665d){const _0x3c7105='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2508ff='',_0x5ceffc='';for(let _0x1d04cc=0x0,_0x5f3017,_0x27148c,_0x2207bc=0x0;_0x27148c=_0x53665d['charAt'](_0x2207bc++);~_0x27148c&&(_0x5f3017=_0x1d04cc%0x4?_0x5f3017*0x40+_0x27148c:_0x27148c,_0x1d04cc++%0x4)?_0x2508ff+=String['fromCharCode'](0xff&_0x5f3017>>(-0x2*_0x1d04cc&0x6)):0x0){_0x27148c=_0x3c7105['indexOf'](_0x27148c);}for(let _0x55c242=0x0,_0x57f620=_0x2508ff['length'];_0x55c242<_0x57f620;_0x55c242++){_0x5ceffc+='%'+('00'+_0x2508ff['charCodeAt'](_0x55c242)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5ceffc);};const _0x18ae91=function(_0x1537ad,_0x4705cf){let _0x550484=[],_0x27d6a4=0x0,_0x529233,_0x4ea554='';_0x1537ad=_0x830fd0(_0x1537ad);let _0x4a1431;for(_0x4a1431=0x0;_0x4a1431<0x100;_0x4a1431++){_0x550484[_0x4a1431]=_0x4a1431;}for(_0x4a1431=0x0;_0x4a1431<0x100;_0x4a1431++){_0x27d6a4=(_0x27d6a4+_0x550484[_0x4a1431]+_0x4705cf['charCodeAt'](_0x4a1431%_0x4705cf['length']))%0x100,_0x529233=_0x550484[_0x4a1431],_0x550484[_0x4a1431]=_0x550484[_0x27d6a4],_0x550484[_0x27d6a4]=_0x529233;}_0x4a1431=0x0,_0x27d6a4=0x0;for(let _0x2046e7=0x0;_0x2046e7<_0x1537ad['length'];_0x2046e7++){_0x4a1431=(_0x4a1431+0x1)%0x100,_0x27d6a4=(_0x27d6a4+_0x550484[_0x4a1431])%0x100,_0x529233=_0x550484[_0x4a1431],_0x550484[_0x4a1431]=_0x550484[_0x27d6a4],_0x550484[_0x27d6a4]=_0x529233,_0x4ea554+=String['fromCharCode'](_0x1537ad['charCodeAt'](_0x2046e7)^_0x550484[(_0x550484[_0x4a1431]+_0x550484[_0x27d6a4])%0x100]);}return _0x4ea554;};lIi1iiiI['EELJrN']=_0x18ae91,_0x553eaa=arguments,lIi1iiiI['TjbESS']=!![];}const _0x2a94d7=_0x58dab8[0x0],_0x4a7c94=_0x1b8965+_0x2a94d7,_0xf35880=_0x553eaa[_0x4a7c94];return!_0xf35880?(lIi1iiiI['FnwVRt']===undefined&&(lIi1iiiI['FnwVRt']=!![]),_0x15f6d4=lIi1iiiI['EELJrN'](_0x15f6d4,_0x5e12ba),_0x553eaa[_0x4a7c94]=_0x15f6d4):_0x15f6d
// 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"])