diff --git a/gacmotor.js b/gacmotor.js index ba544e2..9b6c6b1 100644 --- a/gacmotor.js +++ b/gacmotor.js @@ -3,7 +3,7 @@ * Show:广汽传祺 评论 分享(转发) 签到 发表文章 * @author https://github.com/smallfawn/QLScriptPublic * @tips 本脚本适用于广汽传祺5.0.0以上的版本 - * @update 2023/12/31 所有变量全部写到 脚本同目录下GacmotorCookies.json文件 + * @update 2024/1/17 新增 广汽传祺年度报告抽奖 * 文件内基本格式 [{"AT":"","RT":""},{"AT":"","RT":""}] 仓库( https://ghproxy.smallfawn.top/https://raw.githubusercontent.com/smallfawn/QLScriptPublic/main/GacmotorCookies.json )里面有基本模板 使用前必须填写COOKIE * 提供三种获取变量COOKIE方式 * 1.手动抓https://next.gacmotor.com/app @@ -20,7 +20,7 @@ let GacmotorCookies = './GacmotorCookies.json';//指定文件目录 const $ = new Env("广汽传祺"); const notify = $.isNode() ? require('./sendNotify') : ''; //const { updateEnv11, getEnvs, updateEnv } = require("./ql") -const appVersion = "5.1.0" +const appVersion = "5.1.1" //let ckName = "gacmotorToken"; //let envSplitor = ["@", "\n"]; //多账号分隔符 let strSplitor = "#"; //多变量分隔符 @@ -30,7 +30,7 @@ const fs = require('fs'); let TempAccount = []; -function ReadFiles(filename) { +function ReadFiles (filename) { let Fileexists = fs.existsSync(filename);//检测文件是否存在 if (Fileexists) {//如果存在 console.log("检测到广汽传祺GacmotorCookies.json,载入..."); @@ -41,7 +41,7 @@ function ReadFiles(filename) { } } } -async function writeFile(fileName, data) { +async function writeFile (fileName, data) { return new Promise((resolve, reject) => { fs.writeFile(fileName, data, 'utf8', (err) => { if (err) { @@ -88,7 +88,7 @@ class UserInfo { this.commenttext = "" } - async main() { + async main () { $.log(`==============开始第${this.index}个账号==============`) await this._userInfo(); @@ -108,7 +108,7 @@ class UserInfo { } - async mainTask() { + async mainTask () { if (process.env["gacmotorLuckyDram"] == undefined) { await this._luckyDrawNum()//获取抽奖次数 if (this.luckyDrawNum > 1) { @@ -223,11 +223,13 @@ class UserInfo { } } + + await this._activity_lotter_common({ "activityId": "531", "channel": "carapp_channel" }) //await this._getChinaTime() /*console.log(`11/26截止 Do - 广州车展活动 奖品活动结束后14日内发放`); if (this.BeiJingTime < 1701014400000) { //{"activityId":"467","channel":"carapp_channel"} - await this._activity_lotter_common({ "activityId": "467", "channel": "carapp_channel" }) + // await this._activity_lotter_common({ "activityId": "467", "channel": "carapp_channel" }) }*/ /*每天助力 gacmotorPower="" (抓这个需要手动做一次任务,我的-超级合伙人-每日任务-分享,微信自己点击自己分享的文章一次) * 微信抓gmp.spgacmotorsc.com/partner/api-content/base/content/trafficStatistics? @@ -281,7 +283,7 @@ class UserInfo { } }*/ } - async _refreshToken() { + async _refreshToken () { try { let options = { fn: "刷新token", @@ -338,7 +340,7 @@ class UserInfo { } } - async _getChinaTime() { + async _getChinaTime () { try { let options = { fn: "获取北京时间", @@ -352,7 +354,7 @@ class UserInfo { console.log(e); } } - async _activity_lotter_common(body) { + async _activity_lotter_common (body) { try { let options = { fn: "活动抽奖", @@ -389,7 +391,7 @@ class UserInfo { console.log(e); } } - async _activity_lotter_mall(body) { + async _activity_lotter_mall (body) { try { let options = { fn: "活动抽奖(mall)", @@ -412,7 +414,7 @@ class UserInfo { } } - async _question_list(body) { + async _question_list (body) { try { let options = { fn: "获取答题活动列表", @@ -440,7 +442,7 @@ class UserInfo { } - async _question_info(body) { + async _question_info (body) { try { let options = { fn: "获取问题和选项", @@ -470,7 +472,7 @@ class UserInfo { } - async _submit_answer(body) { + async _submit_answer (body) { try { let options = { fn: "回答问题", @@ -492,7 +494,7 @@ class UserInfo { console.log(e); } } - async _getText() { + async _getText () { try { let textList = [] let options = { @@ -516,7 +518,7 @@ class UserInfo { console.log(e); } } - _getText1() { + _getText1 () { try { let textList = [ `好看好用,我也想拥有同款!`, @@ -532,7 +534,7 @@ class UserInfo { } } - async _join_power(taskId) { + async _join_power (taskId) { try { let options = { fn: "加入助力", @@ -555,7 +557,7 @@ class UserInfo { console.log(e); } } - async _power_list() { + async _power_list () { try { let options = { fn: "助力任务列表获取", @@ -583,7 +585,7 @@ class UserInfo { } } - async _power_auth() { + async _power_auth () { try { let headers = this._getHeaders("get") headers["Host"] = `gmp.spgacmotorsc.com` @@ -609,7 +611,7 @@ class UserInfo { } } - async _get_power_id(taskId) { + async _get_power_id (taskId) { try { let options = { fn: "助力任务ID获取", @@ -640,7 +642,7 @@ class UserInfo { } } - async _share_power(taskId) { + async _share_power (taskId) { try { let options = { fn: "助力任务分享", @@ -663,7 +665,7 @@ class UserInfo { console.log(e); } } - async _power() { + async _power () { try { let options = { fn: "助力", @@ -697,7 +699,7 @@ class UserInfo { console.log(e); } } - async _userInfo() { + async _userInfo () { try { let options = { fn: "信息查询", @@ -726,7 +728,7 @@ class UserInfo { console.log(e); } } - async _taskList() { + async _taskList () { try { let options = { fn: "任务情况查询", @@ -752,7 +754,7 @@ class UserInfo { console.log(e); } } - async _luckyDrawNum() { + async _luckyDrawNum () { try { let options = { fn: "抽奖次数查询", @@ -776,7 +778,7 @@ class UserInfo { console.log(e); } } - async _luckyDraw() { + async _luckyDraw () { try { let options = { fn: "抽奖", @@ -801,7 +803,7 @@ class UserInfo { console.log(e); } } - async _getGDou() { + async _getGDou () { try { let options = { fn: "G豆查询", @@ -825,7 +827,7 @@ class UserInfo { } } - async _applatestlist() { + async _applatestlist () { try { let options = { fn: "最新帖子列表", @@ -847,7 +849,7 @@ class UserInfo { console.log(e); } } - async _signInStatus() { + async _signInStatus () { try { let options = { fn: "签到查询", @@ -876,7 +878,7 @@ class UserInfo { } } - async _signInCounts() { + async _signInCounts () { try { let options = { fn: "签到信息", @@ -899,7 +901,7 @@ class UserInfo { } } - async _signIn() { + async _signIn () { try { let options = { fn: "签到执行", @@ -922,7 +924,7 @@ class UserInfo { } } - async _forward(postId) { + async _forward (postId) { try { let options = { fn: "转发", @@ -946,7 +948,7 @@ class UserInfo { } } - async _add(postId, commentContent) { + async _add (postId, commentContent) { try { let options = { fn: "评论", @@ -970,7 +972,7 @@ class UserInfo { } } - async _commentlist() { + async _commentlist () { try { let options = { fn: "获取评论列表", @@ -995,7 +997,7 @@ class UserInfo { console.log(e); } } - async _commentdelete(commentId) { + async _commentdelete (commentId) { try { let options = { fn: "删除评论", @@ -1018,7 +1020,7 @@ class UserInfo { console.log(e); } } - async _post(postTitle, postContent) { + async _post (postTitle, postContent) { try { let options = { fn: "发表文章", @@ -1042,7 +1044,7 @@ class UserInfo { } } - async _delete(postId) { + async _delete (postId) { try { let options = { fn: "删除文章", @@ -1066,7 +1068,7 @@ class UserInfo { } } - async _postlist() { + async _postlist () { try { let options = { fn: "文章列表", @@ -1090,11 +1092,11 @@ class UserInfo { console.log(e); } } - _MD5(str) { + _MD5 (str) { const crypto = require("crypto"); return crypto.createHash("md5").update(str).digest("hex"); } - _getHeaders(method) { + _getHeaders (method) { let timestamp1 = new Date().getTime(); let timestamp2 = new Date().getTime(); let nonce = Math.floor(100000 + Math.random() * 900000); @@ -1159,7 +1161,7 @@ class UserInfo { } } } - _getHeaders_gmp(method) { + _getHeaders_gmp (method) { let timestamp2 = new Date().getTime(); let apiSignKey = `a361588rt20dpol` let apiSign = (this._MD5(`${timestamp2}${apiSignKey}`)).toUpperCase() @@ -1207,7 +1209,7 @@ class UserInfo { } } } - _getHeaders_mall(method) { + _getHeaders_mall (method) { if (method == "get") { return { "Host": "mall.gacmotor.com", @@ -1246,7 +1248,7 @@ class UserInfo { } } -async function start() { +async function start () { if (process.env["gacmotorPost"] == "true") { $.log(`已开启发帖`) } else { @@ -1288,10 +1290,10 @@ async function start() { * 变量检查与处理 * @returns */ -async function checkEnv() { +async function checkEnv () { ReadFiles(GacmotorCookies) if (TempAccount.length <= 0) { - return + return } for (let cookie of TempAccount) { if (cookie["AT"] && cookie["RT"]) { @@ -1305,7 +1307,7 @@ async function checkEnv() { } ///////////////////////////////////////////////////////////////////////////////////// -function httpRequest(options) { +function httpRequest (options) { if (!options["method"]) { return console.log(`请求方法不存在`); } @@ -1330,7 +1332,7 @@ function httpRequest(options) { }); }); } -async function SendMsg(message) { +async function SendMsg (message) { if (!message) return; if ($.isNode()) { await notify.sendNotify($.name, message) @@ -1339,4 +1341,4 @@ async function SendMsg(message) { } } // prettier-ignore -function Env(t, s) { return new (class { constructor(t, s) { (this.name = t), (this.data = null), (this.dataFile = "box.dat"), (this.logs = []), (this.logSeparator = "\n"), (this.startTime = new Date().getTime()), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name},\u5f00\u59cb!`) } 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 } getScript(t) { return new Promise((s) => { this.get({ url: t }, (t, e, i) => s(i)) }) } runScript(t, s) { return new Promise((e) => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let o = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); (o = o ? 1 * o : 20), (o = s && s.timeout ? s.timeout : o); const [h, a] = i.split("@"), r = { url: `http://${a}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: o }, headers: { "X-Key": h, Accept: "*/*" }, }; this.post(r, (t, s, i) => e(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), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s); if (!e && !i) return {}; { const i = e ? t : s; 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), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), o = JSON.stringify(this.data); e ? this.fs.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o) } } lodash_get(t, s, e) { const i = s.replace(/\[(\d+)\]/g, ".$1").split("."); let o = t; for (const t of i) if (((o = Object(o)[t]), void 0 === o)) return e; return o } lodash_set(t, s, e) { return Object(t) !== t ? t : (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []), (s.slice(0, -1).reduce((t, e, i) => Object(t[e]) === t[e] ? t[e] : (t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}), t)[s[s.length - 1]] = e), t) } getdata(t) { let s = this.getval(t); if (/^@/.test(t)) { const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t), o = e ? this.getval(e) : ""; if (o) try { const t = JSON.parse(o); s = t ? this.lodash_get(t, i, "") : s } catch (t) { s = "" } } return s } setdata(t, s) { let e = !1; if (/^@/.test(s)) { const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s), h = this.getval(i), a = i ? ("null" === h ? null : h || "{}") : "{}"; try { const s = JSON.parse(a); this.lodash_set(s, o, t), (e = this.setval(JSON.stringify(s), i)) } catch (s) { const h = {}; this.lodash_set(h, o, t), (e = this.setval(JSON.stringify(h), i)) } } else e = this.setval(t, s); return e } 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, s) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? ((this.data = this.loaddata()), (this.data[s] = t), this.writedata(), !0) : (this.data && this.data[s]) || 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, s = () => { }) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => { !t && e && ((e.body = i), (e.statusCode = e.status)), s(t, e, i) }) : this.isQuanX() ? $task.fetch(t).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => { try { const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(e, null), (s.cookieJar = this.ckjar) } catch (t) { this.logErr(t) } }).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h, } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t))) } post(t, s = () => { }) { if ((t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon())) $httpClient.post(t, (t, e, i) => { !t && e && ((e.body = i), (e.statusCode = e.status)), s(t, e, i) }); else if (this.isQuanX()) (t.method = "POST"), $task.fetch(t).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: e, ...i } = t; this.got.post(e, i).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)) } } time(t) { let s = { "M+": new Date().getMonth() + 1, "d+": new Date().getDate(), "H+": new Date().getHours(), "m+": new Date().getMinutes(), "s+": new Date().getSeconds(), "q+": Math.floor((new Date().getMonth() + 3) / 3), S: new Date().getMilliseconds(), }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (new Date().getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in s) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? s[e] : ("00" + s[e]).substr(("" + s[e]).length))); return t } msg(s = t, e = "", i = "", o) { const h = (t) => !t || (!this.isLoon() && this.isSurge()) ? t : "string" == typeof t ? this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : void 0 : "object" == typeof t && (t["open-url"] || t["media-url"]) ? this.isLoon() ? t["open-url"] : this.isQuanX() ? t : void 0 : void 0; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(s, e, i, h(o)) : this.isQuanX() && $notify(s, e, i, h(o))); let logs = ['', '==============📣系统通知📣==============']; logs.push(t); e ? logs.push(e) : ''; i ? logs.push(i) : ''; console.log(logs.join('\n')); this.logs = this.logs.concat(logs) } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, s) { const e = !this.isSurge() && !this.isQuanX() && !this.isLoon(); e ? this.log("", `\u2757\ufe0f${this.name},\u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name},\u9519\u8bef!`, t) } wait(t) { return new Promise((s) => setTimeout(s, t)) } done(t = {}) { const s = new Date().getTime(), e = (s - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name},\u7ed3\u675f!\ud83d\udd5b ${e}\u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } })(t, s) } +function Env (t, s) { return new (class { constructor(t, s) { (this.name = t), (this.data = null), (this.dataFile = "box.dat"), (this.logs = []), (this.logSeparator = "\n"), (this.startTime = new Date().getTime()), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name},\u5f00\u59cb!`) } 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 } getScript (t) { return new Promise((s) => { this.get({ url: t }, (t, e, i) => s(i)) }) } runScript (t, s) { return new Promise((e) => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let o = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); (o = o ? 1 * o : 20), (o = s && s.timeout ? s.timeout : o); const [h, a] = i.split("@"), r = { url: `http://${a}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: o }, headers: { "X-Key": h, Accept: "*/*" }, }; this.post(r, (t, s, i) => e(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), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s); if (!e && !i) return {}; { const i = e ? t : s; 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), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), o = JSON.stringify(this.data); e ? this.fs.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o) } } lodash_get (t, s, e) { const i = s.replace(/\[(\d+)\]/g, ".$1").split("."); let o = t; for (const t of i) if (((o = Object(o)[t]), void 0 === o)) return e; return o } lodash_set (t, s, e) { return Object(t) !== t ? t : (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []), (s.slice(0, -1).reduce((t, e, i) => Object(t[e]) === t[e] ? t[e] : (t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}), t)[s[s.length - 1]] = e), t) } getdata (t) { let s = this.getval(t); if (/^@/.test(t)) { const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t), o = e ? this.getval(e) : ""; if (o) try { const t = JSON.parse(o); s = t ? this.lodash_get(t, i, "") : s } catch (t) { s = "" } } return s } setdata (t, s) { let e = !1; if (/^@/.test(s)) { const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s), h = this.getval(i), a = i ? ("null" === h ? null : h || "{}") : "{}"; try { const s = JSON.parse(a); this.lodash_set(s, o, t), (e = this.setval(JSON.stringify(s), i)) } catch (s) { const h = {}; this.lodash_set(h, o, t), (e = this.setval(JSON.stringify(h), i)) } } else e = this.setval(t, s); return e } 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, s) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? ((this.data = this.loaddata()), (this.data[s] = t), this.writedata(), !0) : (this.data && this.data[s]) || 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, s = () => { }) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => { !t && e && ((e.body = i), (e.statusCode = e.status)), s(t, e, i) }) : this.isQuanX() ? $task.fetch(t).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => { try { const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(e, null), (s.cookieJar = this.ckjar) } catch (t) { this.logErr(t) } }).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h, } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t))) } post (t, s = () => { }) { if ((t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon())) $httpClient.post(t, (t, e, i) => { !t && e && ((e.body = i), (e.statusCode = e.status)), s(t, e, i) }); else if (this.isQuanX()) (t.method = "POST"), $task.fetch(t).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: e, ...i } = t; this.got.post(e, i).then((t) => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, (t) => s(t)) } } time (t) { let s = { "M+": new Date().getMonth() + 1, "d+": new Date().getDate(), "H+": new Date().getHours(), "m+": new Date().getMinutes(), "s+": new Date().getSeconds(), "q+": Math.floor((new Date().getMonth() + 3) / 3), S: new Date().getMilliseconds(), }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (new Date().getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in s) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? s[e] : ("00" + s[e]).substr(("" + s[e]).length))); return t } msg (s = t, e = "", i = "", o) { const h = (t) => !t || (!this.isLoon() && this.isSurge()) ? t : "string" == typeof t ? this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : void 0 : "object" == typeof t && (t["open-url"] || t["media-url"]) ? this.isLoon() ? t["open-url"] : this.isQuanX() ? t : void 0 : void 0; this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(s, e, i, h(o)) : this.isQuanX() && $notify(s, e, i, h(o))); let logs = ['', '==============📣系统通知📣==============']; logs.push(t); e ? logs.push(e) : ''; i ? logs.push(i) : ''; console.log(logs.join('\n')); this.logs = this.logs.concat(logs) } log (...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr (t, s) { const e = !this.isSurge() && !this.isQuanX() && !this.isLoon(); e ? this.log("", `\u2757\ufe0f${this.name},\u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name},\u9519\u8bef!`, t) } wait (t) { return new Promise((s) => setTimeout(s, t)) } done (t = {}) { const s = new Date().getTime(), e = (s - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name},\u7ed3\u675f!\ud83d\udd5b ${e}\u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } })(t, s) }