KR/jd_lottery.js

12 lines
112 KiB
JavaScript
Raw Normal View History

2023-07-27 16:14:01 +08:00
/*
[task_local]
#京东抽奖机通用
11 11 11 11 * jd_lottery.js, tag=京东抽奖机通用, enabled=true
//变量export JD_Lottery="id" 多个使用 @ 连接
*/
const $ = new Env('京东抽奖机通用-KR');
var __encode ='jsjiami.com',_a={}, _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(_a);var __Oxf0561=["\x6A\x73\x6A\x69\x61\x6D\x69\x2E\x63\x6F\x6D\x2E\x76\x36","\u202E\x5F\x30\x78\x6F\x64\x46","\x77\x35\x2F\x44\x6D\x4D\x4F\x38\x77\x35\x4C\x44\x70\x52\x2F\x43\x6D\x51\x3D\x3D","\x77\x35\x62\x44\x71\x77\x45\x3D","\x49\x63\x4B\x79\x77\x34\x66\x44\x6E\x38\x4B\x77\x65\x43\x4E\x63\x44\x4D\x4B\x48\x77\x70\x62\x44\x67\x51\x3D\x3D","\x46\x6B\x76\x44\x6D\x38\x4B\x44\x77\x72\x34\x3D","\x55\x67\x78\x6A\x77\x71\x51\x36","\x5A\x38\x4F\x55\x77\x72\x66\x44\x68\x73\x4F\x63","\x64\x63\x4B\x48\x77\x36\x73\x6E\x77\x70\x6A\x44\x70\x4D\x4B\x41","\x54\x38\x4F\x4C\x77\x71\x62\x44\x74\x38\x4F\x77\x77\x36\x56\x31","\x61\x6B\x6E\x43\x72\x73\x4B\x44\x77\x70\x55\x3D","\x57\x45\x4D\x48\x44\x33\x34\x3D","\x54\x38\x4B\x71\x58\x63\x4B\x61\x77\x34\x58\x44\x72\x77\x3D\x3D","\x49\x63\x4F\x50\x52\x63\x4F\x72\x77\x35\x62\x43\x69\x77\x3D\x3D","\x77\x72\x64\x4E\x77\x71\x33\x44\x69\x7A\x77\x3D","\x55\x73\x4F\x30\x77\x70\x76\x44\x75\x4D\x4F\x41","\x77\x71\x67\x43\x63\x58\x72\x43\x75\x67\x3D\x3D","\x77\x35\x6E\x44\x6B\x31\x30\x66\x52\x73\x4B\x72","\x77\x71\x6B\x35\x62\x7A\x6C\x4F","\x4D\x69\x72\x44\x74\x67\x3D\x3D","\x77\x72\x6C\x48\x4A\x53\x35\x59\x5A\x6B\x77\x56\x43\x53\x6E\x44\x6E\x73\x4F\x2B\x4C\x63\x4F\x6A\x77\x71\x50\x44\x6E\x67\x3D\x3D","\x42\x73\x4B\x6C\x66\x6D\x72\x44\x72\x42\x49\x54\x50\x63\x4F\x4C\x65\x47\x44\x43\x74\x63\x4B\x78\x48\x58\x64\x68\x4F\x44\x50\x44\x76\x73\x4F\x71\x50\x44\x54\x44\x6B\x67\x3D\x3D","\x77\x37\x6F\x66\x4B\x53\x59\x6A\x65\x6E\x4D\x71\x59\x38\x4B\x53\x41\x46\x58\x44\x71\x63\x4F\x45","\x77\x34\x33\x44\x6E\x6D\x51\x50\x5A\x67\x3D\x3D","\x77\x36\x62\x43\x70\x73\x4B\x4D\x77\x71\x6E\x44\x76\x67\x3D\x3D","\x77\x72\x67\x54\x77\x70\x67\x3D","\x51\x63\x4B\x33\x52\x63\x4B\x65\x77\x35\x50\x43\x70\x31\x6C\x70\x50\x4D\x4B\x6B\x77\x6F\x72\x44\x6F\x4D\x4F\x5A\x77\x36\x4E\x45\x77\x70\x55\x37\x77\x36\x74\x38\x66\x73\x4B\x68\x57\x38\x4B\x58\x77\x71\x56\x76\x77\x35\x72\x43\x70\x51\x54\x44\x68\x6D\x2F\x44\x6A\x63\x4B\x35\x4D\x73\x4B\x57\x42\x73\x4B\x68\x47\x6A\x31\x66\x41\x47\x67\x4E\x66\x7A\x66\x43\x6A\x6D\x66\x43\x75\x38\x4F\x6C\x4C\x73\x4B\x43\x77\x72\x6F\x53\x5A\x63\x4B\x5A\x4A\x6A\x62\x43\x70\x53\x50\x43\x71\x38\x4F\x47\x77\x72\x5A\x41\x41\x79\x77\x4F\x46\x6C\x45\x47\x58\x6E\x54\x43\x68\x77\x54\x44\x70\x4D\x4B\x56\x77\x72\x68\x6D\x4E\x73\x4B\x36\x77\x6F\x6A\x43\x71\x67\x3D\x3D","\x56\x33\x54\x43\x6F\x38\x4B\x52\x77\x72\x72\x44\x6D\x63\x4B\x41","\x4E\x4D\x4B\x45\x77\x36\x6F\x74\x77\x70\x72\x44\x70\x4D\x4B\x49\x51\x73\x4B\x58\x77\x71\x38\x62\x50\x63\x4B\x59\x47\x32\x66\x44\x6E\x73\x4B\x4A\x77\x35\x4E\x4F\x77\x6F\x30\x34\x77\x70\x48\x44\x6F\x32\x33\x43\x6F\x53\x44\x44\x73\x51\x48\x44\x74\x63\x4F\x4D\x77\x71\x42\x55\x41\x77\x3D\x3D","\x77\x37\x41\x6E\x4E\x73\x4B\x72\x77\x71\x51\x3D","\x77\x71\x54\x44\x70\x63\x4B\x41\x77\x36\x50\x44\x6C\x67\x3D\x3D","\x51\x73\x4B\x54\x52\x73\x4B\x34\x77\x36\x49\x3D","\x53\x4D\x4B\x4B\x77\x36\x38\x4F\x77\x72\x55\x3D","\x77\x6F\x39\x79\x77\x6F\x4C\x44\x6E\x54\x34\x3D","\x77\x72\x4D\x5A\x77\x6F\x73\x3D","\x77\x72\x51\x2F\x77\x6F\x4E\x7A\x77\x71\x48\x43\x68\x73\x4F\x4B\x66\x33\x67\x3D","\x77\x37\x33\x44\x75\x63\x4B\x6E","\x59\x4D\x4B\x49\x62\x48\x54\x6F\x72\x62\x7A\x6D\x73\x72\x4C\x6C\x70\x59\x48\x6F\x74\x62\x62\x76\x76\x6F\x58\x6F\x72\x72\x50\x6D\x6F\x4A\x54\x6D\x6E\x35\x33\x6E\x76\x37\x66\x6F\x74\x49\x72\x70\x68\x4A\x58\x6F\x72\x71\x59\x3D","\x77\x71\x38\x58\x77\x70\x37\x43\x69\x73\x4B\x5A","\x43\x63\x4F\x4D\x61\x38\x4F\x6C\x77\x36\x4D\x3D","\x77\x72\x6C\x41\x48\x52\x4E\x6C","\x77\x6F\x54\x44\x76\x63\x4B\x46\x77\x35\x44\x44\x6F\x67\x3D\x3D","\x57\x63\x4B\x32\x51\x73\x4B\x47","\x77\x36\x2F\x44\x6E\x6E\x6F\x77\x62\x67\x3D\x3D","\x77\x35\x46\x36\x77\x70\x52\x6A","\x77\x35\x6E\x44\x6C\x30\x51\x61\x57\x38\x4B\x69\x66\x42\x33\x44\x72\x4D\x4F\x52","\x58\x48\x37\x43\x73\x41\x3D\x3D","\x35
// 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"])