faker3/jd_supermarket_draw.js

16 lines
35 KiB
JavaScript
Raw Normal View History

2024-07-12 20:19:07 +08:00
/*
活动名称超市卡抽奖
环境变量jd_supermarket_threads // 控制并发线程数正整数默认1最大3尽量使用默认值否则请开启代理运行
jd_supermarket_interval // 自定义运行间隔时长整数单位毫秒默认1000
jd_supermarket_notify // 是否推送通知true/false默认不推送
jd_supermarket_pinFilter // 账号pin过滤多个用@进行分割
cron:1 1 1 1 *
*/
const $ = new Env('超市卡抽奖')
2024-07-13 14:24:58 +08:00
const _0x552317=_0xe2f3;(function(_0x8fdf56,_0x23b7e8){const _0x689e7b=_0xe2f3,_0x372ea5=_0x8fdf56();while(!![]){try{const _0x58c85d=parseInt(_0x689e7b(0x1c4,'5Lja'))/0x1+parseInt(_0x689e7b(0x23d,'R5N7'))/0x2+parseInt(_0x689e7b(0x1c0,'qP^E'))/0x3*(parseInt(_0x689e7b(0x208,'VhZT'))/0x4)+parseInt(_0x689e7b(0x176,'OdTw'))/0x5+parseInt(_0x689e7b(0x1d0,'nl)r'))/0x6+-parseInt(_0x689e7b(0x1ef,'5Lja'))/0x7*(-parseInt(_0x689e7b(0x214,'MnNW'))/0x8)+-parseInt(_0x689e7b(0x1a4,'8NhF'))/0x9;if(_0x58c85d===_0x23b7e8)break;else _0x372ea5['push'](_0x372ea5['shift']());}catch(_0x226275){_0x372ea5['push'](_0x372ea5['shift']());}}}(_0x9c38,0x4c1bd));const jdCookie=require(_0x552317(0x238,'!1ZE')),notify=require(_0x552317(0x17e,'!Eon')),common=require(_0x552317(0x158,'VhZT')),{H5st}=require(_0x552317(0x1aa,'I87A'));console[_0x552317(0x154,'oW0g')](''),console[_0x552317(0x1ab,'I5hS')](_0x552317(0x1e7,'BGUV')+$[_0x552317(0x134,'&em%')]+_0x552317(0x1c7,'OdTw')),console['log']('jd_supermarket_threads\x20//\x20控制并发线程数默认1最大10'),console[_0x552317(0x18d,'uWiC')](_0x552317(0x173,'OdTw')),console['log'](_0x552317(0x180,'3nqW')),console[_0x552317(0x1e9,'*%)0')](_0x552317(0x14c,'v0rP')),console[_0x552317(0x1cc,'25rs')](_0x552317(0x21f,'VhZT')+$[_0x552317(0x1d9,'8NhF')]+_0x552317(0x248,'qP^E')),console['log']('');function _0xe2f3(_0x2393d2,_0x32ed6d){const _0x9c3853=_0x9c38();return _0xe2f3=function(_0xe2f3da,_0x2d596d){_0xe2f3da=_0xe2f3da-0x12e;let _0x31234a=_0x9c3853[_0xe2f3da];if(_0xe2f3['NZTTpk']===undefined){var _0x2f855c=function(_0x2805e9){const _0x47df84='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x19898d='',_0x14cb63='';for(let _0x47cc73=0x0,_0x404206,_0x5337a9,_0xac3554=0x0;_0x5337a9=_0x2805e9['charAt'](_0xac3554++);~_0x5337a9&&(_0x404206=_0x47cc73%0x4?_0x404206*0x40+_0x5337a9:_0x5337a9,_0x47cc73++%0x4)?_0x19898d+=String['fromCharCode'](0xff&_0x404206>>(-0x2*_0x47cc73&0x6)):0x0){_0x5337a9=_0x47df84['indexOf'](_0x5337a9);}for(let _0x2a6198=0x0,_0x33aad0=_0x19898d['length'];_0x2a6198<_0x33aad0;_0x2a6198++){_0x14cb63+='%'+('00'+_0x19898d['charCodeAt'](_0x2a6198)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x14cb63);};const _0x5ec1cd=function(_0x3e36fb,_0x207d59){let _0x126dfb=[],_0x3d9aec=0x0,_0x40a385,_0x41a395='';_0x3e36fb=_0x2f855c(_0x3e36fb);let _0x362bed;for(_0x362bed=0x0;_0x362bed<0x100;_0x362bed++){_0x126dfb[_0x362bed]=_0x362bed;}for(_0x362bed=0x0;_0x362bed<0x100;_0x362bed++){_0x3d9aec=(_0x3d9aec+_0x126dfb[_0x362bed]+_0x207d59['charCodeAt'](_0x362bed%_0x207d59['length']))%0x100,_0x40a385=_0x126dfb[_0x362bed],_0x126dfb[_0x362bed]=_0x126dfb[_0x3d9aec],_0x126dfb[_0x3d9aec]=_0x40a385;}_0x362bed=0x0,_0x3d9aec=0x0;for(let _0x450bac=0x0;_0x450bac<_0x3e36fb['length'];_0x450bac++){_0x362bed=(_0x362bed+0x1)%0x100,_0x3d9aec=(_0x3d9aec+_0x126dfb[_0x362bed])%0x100,_0x40a385=_0x126dfb[_0x362bed],_0x126dfb[_0x362bed]=_0x126dfb[_0x3d9aec],_0x126dfb[_0x3d9aec]=_0x40a385,_0x41a395+=String['fromCharCode'](_0x3e36fb['charCodeAt'](_0x450bac)^_0x126dfb[(_0x126dfb[_0x362bed]+_0x126dfb[_0x3d9aec])%0x100]);}return _0x41a395;};_0xe2f3['FObROc']=_0x5ec1cd,_0x2393d2=arguments,_0xe2f3['NZTTpk']=!![];}const _0x203ed0=_0x9c3853[0x0],_0x3505a1=_0xe2f3da+_0x203ed0,_0x4375a9=_0x2393d2[_0x3505a1];return!_0x4375a9?(_0xe2f3['MwYOVs']===undefined&&(_0xe2f3['MwYOVs']=!![]),_0x31234a=_0xe2f3['FObROc'](_0x31234a,_0x2d596d),_0x2393d2[_0x3505a1]=_0x31234a):_0x31234a=_0x4375a9,_0x31234a;},_0xe2f3(_0x2393d2,_0x32ed6d);}let linkId,taskThreads=process[_0x552317(0x141,'uWiC')]['jd_supermarket_threads']||'1';const runInterval=process['env'][_0x552317(0x151,'BGUV')]||'1000',isNotify=(process['env']['jd_supermarket_notify']||process[_0x552317(0x142,'F]YB')]['jd_supermarket_Notify'])===_0x552317(0x201,'&EzC'),pinFilter=(process[_0x552317(0x206,'Y]bA')][_0x552317(0x1ca,'I87A')]||'')['split']('@'),maxThreads=0x3;let shareCodes=[],needRemoveCodes=[],hasGetBasicInfo=![],cookiesArr=Object[_0x552317(0x130,'7KQn')](jdCookie)['map'](_0x5ec1cd=>jdCookie[_0x5ec1cd])['filter'](_0x2805e9=>_0x2805e9);function _0x9c38(){const _0x
2024-07-12 20:19:07 +08:00
// 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"])