mirror of
https://github.com/shufflewzc/faker3.git
synced 2025-03-14 22:54:41 +08:00
15 lines
100 KiB
JavaScript
15 lines
100 KiB
JavaScript
|
/*
|
|||
|
环境变量:
|
|||
|
export jd_opencard_draw="3" //抽奖次数 3
|
|||
|
export jd_opencard_notify="true" // 是否推送
|
|||
|
|
|||
|
cron:59 23 29 2 *
|
|||
|
|
|||
|
*/
|
|||
|
|
|||
|
const $ = new Env('1.22 年货就要“新”意满满')
|
|||
|
function Eqenhg(){}var o_kcWq=Object['\x64\x65\x66\x69\x6e\x65\x50\x72\x6f\x70\x65\x72\x74\x79'],TszvGXj,GkNEAz,iam2bU8,bzxlcF,CfifSp,L6P83I,flWy6T,huoeAz,zMc2Rw,do2mcP,oFZqz4v,MAyEnC,jmAV9Bv,cx09Fs,WMkmwY,Sn9CpEE;function Rv6OF1n(Eqenhg){return TszvGXj[Eqenhg>0x8c?Eqenhg+0x27:Eqenhg-0x20]}Eqenhg(TszvGXj=G6w0ab(),GkNEAz=pAlLzqU((Eqenhg,o_kcWq)=>{return o_kcWq(Eqenhg())},0x2)(xwZh5P,RXJnmK));var g619r51=[],BrVSSU=[mbc4vDz(Rv6OF1n(0x32)),mbc4vDz(Rv6OF1n(0x3a)),mbc4vDz(Rv6OF1n(0x3e)),'3KLR2','\u007b\u005d\u0031\u0052','(tX,Z3q!&^+sciU(&d/97o*','\u0069\u003f\u002c\u0023\u002f','\x28\x74\x58\x2c\x5a\x33\x71\x21\x26\x5e\x2b\x73\x63\x69\x7c\x76\x5a\x6a\x7b\x52','\u0031\u0064\u004e\u0052\u0035\u0057\u0077\u006f\u0067\u005f\u0036\u0058\u007d\u0063\u0029\u0065\u0062\u0031\u0045\u006b\u006e\u0023\u0035\u0036\u002c\u0079\u004a\u007d\u003d\u0069\u007c\u0065\u0026\u005d\u004e\u0053\u0025\u0053\u002a','\u0044\u0075\u0035\u002b\u0029',mbc4vDz(Rv6OF1n(0x35)),']|=f#b<T','\x4b\x39\x72\x66',mbc4vDz(0x4),'\u007b\u0054\u0040\u0064\u0063\u004c\u003f\u0038\u0071\u0029\u002e\u0045\u0069\u0063\u0062\u0057\u0064\u0046\u0024\u0038\u0071\u004d\u0021\u0069\u002f\u006b\u0023\u0044\u0037\u005d\u004c\u0041\u0075\u0023\u0073\u0050\u002f','dh0f2','\x76\x22\x72\x66',mbc4vDz(0x4),'\x3b\x75\x4e\x52\x6c\x21\x65\x51\x42\x46\x39\x55\x7c\x7d\x67\x65\x30\x4f','\x34\x48\x7d\x69\x60\x57\x36\x49\x26\x50\x3f\x4f\x2f\x55\x65\x2a\x7a\x54\x35\x7c\x3f\x26\x72\x58\x41\x7d\x55\x67\x4f\x7c\x5b\x21\x34\x66\x37\x41\x74\x41\x37\x37\x61\x37\x6f','\u0035\u0055\u0026\u0076\u0048\u003e\u005d\u003a\u0048\u006c\u006f',Rv6OF1n(0x20),'.uyk+W|T','\u003e\u0032\u0045\u0060\u0025\u004f\u0063\u0072','E{Nj97MO@9b:*','\u0058\u0060\u0059\u0041\u0028\u0062\u0043\u0068\u0048\u002a','w]bS[k:OS5gy^/lPI?wj97aOG~$U/}|l1?m',mbc4vDz(Rv6OF1n(0x43)),mbc4vDz(Rv6OF1n(0x2b)),Rv6OF1n(0x20),'\x7c\x22\x40\x39\x4c\x4a\x30\x54',mbc4vDz(Rv6OF1n(0x38)),'\u0032\u0077\u006c\u0024\u0043\u0075\u007a\u0072','\u007d\u005d\u0043\u0050\u0077\u003e\u002a','Nw{$?CNDZs1','\u0042\u0061\u0040\u0071\u0077\u006f\u0028\u002b\u002b\u002a','\x3b\x75\x68\x6b\x44\x2b\x43\x56\x7d\x24\x7b\x50\x7c\x7d\x7c\x65\x52\x4f',mbc4vDz(0x8),'\u0063\u0077\u0037\u0041\u004d\u0074\u006a',mbc4vDz(Rv6OF1n(0x21)),'\x67\x4f\x56\x30\x24\x75\x6c\x72',mbc4vDz(Rv6OF1n(0x50)),'\u004a\u0026\u0025\u0041\u0043\u0075\u002e\u0049\u0061\u0044\u0032\u0065\u0057\u0029',mbc4vDz(Rv6OF1n(0x37)),'\x44\x3b\x53\x55\x25','\x5a\x6a\x56\x66\x50\x2b\x6c\x54','\x3b\x75\x3a\x23\x44\x62\x31\x36\x7e\x5e\x49\x47\x4f','\x64\x58\x42\x41\x65\x24\x64\x37\x4f\x37\x7b\x76\x2f\x55\x49\x26',Rv6OF1n(0x26),'\x58\x6d\x68\x6b\x31\x55\x2a',mbc4vDz(0xc),'\x5d\x7c\x36\x23\x79\x53\x4f\x5f\x61','\u0067\u0022\u0036\u0023\u002f','\u007b\u005d\u002c\u0072\u0061\u004a\u003d\u0043\u005a','\u0049\u0039\u006c\u005f\u005d\u0021\u006b\u0061\u0021\u003b',mbc4vDz(Rv6OF1n(0x40)),'\x6e\x2e\x28\x7b\x29\x51\x73\x2b',mbc4vDz(Rv6OF1n(0x3b)),'\u0054\u004a\u0050\u0023\u0042\u0033\u007a\u007b\u0040\u0035\u0068\u004e\u0056\u003e\u0022\u0024\u003e\u0062\u006c\u0071\u0079\u0033\u0038\u003d\u0021\u0070\u0042\u0021\u002a\u004b\u003d\u0061\u006a\u003e\u0070\u005d\u004d\u0048\u004b\u0046\u004c\u0055\u005e\u007d\u002b',mbc4vDz(Rv6OF1n(0x21)),mbc4vDz(0xf),'L"L2jI3i/k#D!^pde01(Zp*',mbc4vDz(Rv6OF1n(0x48)),mbc4vDz(Rv6OF1n(0x49)),mbc4vDz(0x12),mbc4vDz(0x13),'\u007a\u0074\u004b\u007e\u006b\u0051\u003e\u002b','\u002c\u0039\u007a\u007b\u0049\u0047\u0032','\u0042\u002e\u0064\u0037','\u003c\u0066\u003a\u0023\u002f\u0069\u0046\u0030\u0051\u003b\u003d\u005e\u0065\u006a',mbc4vDz(0x14),mbc4vDz(Rv6OF1n(0x23)),mbc4vDz(Rv6OF1n(0x22)),'\x41\x22\x2f\x39\x21\x57\x3d\x54',mbc4vDz(0x17),Rv6OF1n(0x24),mbc4vDz(Rv6OF1n(0x4a)),'\u004a\u004a\u003c\u0067\u0048\u007c\u004b\u0059\u004c','\u0026\u002e\u004b\u007e\u0044','\u0069\u006d\u0063\u0042\u0041\u0068\u0059\u0054','\x4f\x50\x59\x67\x4a\x28\x62\x28\x36\x24\x5f',mbc4vDz(Rv6OF1n(0x46)),Rv6OF1n(0x2c),mbc4vDz(Rv6OF1n(0x4b)),'\x4f\x6f\x47\x56\x47\x5e\x42\x5d\x49\x75\x52\x75\x42\x23\x28\x39','\u0053\u0043\u0022\u0037\u0053\u0061\u0042\u005d\u0049\u0075\u0037\u007c\u0070\u0050\u005d','\x60\x5a\x7b\x54\x7
|
|||
|
|
|||
|
// 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.d
|