diff --git a/daily/aima.js b/daily/aima.js index 36747c2..207e2c2 100644 --- a/daily/aima.js +++ b/daily/aima.js @@ -10,7 +10,7 @@ const $ = new Env("爱玛会员俱乐部"); const axios = require('axios') // ================== 配置区 ================== -const ACTIVITY_ID = "100001180"; // 2026年2月活动ID +const ACTIVITY_ID = "100001192"; // 2026年2月活动ID const BASE_URL = "https://scrm.aimatech.com"; // 使用官方域名,不再硬编码IP const APP_ID = "scrm"; const USER_AGENT = "Mozilla/5.0 (Linux; Android 15; 23013RK75C Build/AQ3A.250226.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/142.0.7444.173 Mobile Safari/537.36 XWEB/1420229 MMWEBSDK/20251101 MMWEBID/6369 MicroMessenger/8.0.67.3000(0x28004333) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android"; @@ -115,7 +115,7 @@ async function signIn(token, index) { } // 发送通知 - await $.sendMsg($.logs.join("\n")); + //await $.sendMsg($.logs.join("\n")); })() .catch((e) => console.log(e)) .finally(() => $.done()); diff --git a/daily/yht.js b/daily/yht.js new file mode 100644 index 0000000..8383397 --- /dev/null +++ b/daily/yht.js @@ -0,0 +1,155 @@ +/* +------------------------------------------ +@Author: sm +@Date: 2024.06.07 19:15 +@Description: +@cron: 30 8 * * * +------------------------------------------ + +------------------------------------------ + +*/ + +const { + Env +} = require("../tools/env") +const $ = new Env("babycare"); +let ckName = `babycare`; +const strSplitor = "#"; + +const axios = require("axios"); +const defaultUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.31(0x18001e31) NetType/WIFI Language/zh_CN miniProgram" + + +class Task { + constructor(env) { + this.index = $.userIdx++ + this.user = env.split(strSplitor); + this.token = this.user[0]; + + } + + async run() { + + await this.getLoginUrl() + } + async getLoginUrl() { + let options = { + method: 'POST', + url: `https://webapi.qmai.cn/web/catering/crm/member/redirect`, + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) UnifiedPCWindowsWechat(0xf254173b) XWEB/19027', + 'Accept': 'v=1.0', + 'Content-Type': 'application/json', + 'xweb_xhr': '1', + 'gdt-vid': '', + 'work-staff-name': '', + 'channelcode': '', + 'work-wechat-userid': '', + 'qz-gtd': '', + 'qm-from-type': 'catering', + 'accept-language': 'zh-CN', + 'scene': '1101', + 'qm-from': 'wechat', + 'qm-user-token': '' + this.token, + 'work-staff-id': '', + 'multi-store-id': '', + 'store-id': '203009', + 'promotion-code': '', + 'sec-fetch-site': 'cross-site', + 'sec-fetch-mode': 'cors', + 'sec-fetch-dest': 'empty', + 'referer': 'https://servicewechat.com/wx4080846d0cec2fd5/517/page-frame.html', + 'priority': 'u=1, i' + }, + data: { + "redirectUrl": "https://86019.activity-12.m.duiba.com.cn/chw/visual-editor/skins?id=203576", + "appid": "wx4080846d0cec2fd5" + } + } + let { + data: result + } = await axios.request(options); + console.log(result); + if (result.data && result.status) { + return result.data + + } + + + + } + ObjectKeys2LowerCase(e) { return e = Object.fromEntries(Object.entries(e).map((([e, t]) => [e.toLowerCase(), t]))), new Proxy(e, { get: function (e, t, r) { return Reflect.get(e, t.toLowerCase(), r) }, set: function (e, t, r, n) { return Reflect.set(e, t.toLowerCase(), r, n) } }) } + + async getActivityToken() { + + + const opts = { + method: "GET", + url: this.activityUrl, + maxRedirects: 0, + // 关键点 2: 默认 Axios 认为非 2xx 是错误,需定义 302 为合法状态 + validateStatus: function (status) { + return status >= 200 && status < 400; // 允许 302 (或 3xx) 进入 .then + }, + headers: {} + } + let res = await axios.request(opts); + + let headers = this.ObjectKeys2LowerCase(res?.headers); + //对青龙进行兼容 + let session = Array.isArray(headers['set-cookie']) ? [...new Set(headers['set-cookie'])].join("") : headers['set-cookie']; + + let [wdata4, w_ts, _ac, wdata3, dcustom] = session.match(/(wdata4|w_ts|_ac|wdata3|dcustom)=.+?;/g) + this.session = wdata4 + w_ts + _ac + wdata3 + dcustom; + $.log(`✅ 获取活动token成功!`) + + + + } + + + + + + + + + +} + +!(async () => { + await getNotice() + $.checkEnv(ckName); + + for (let user of $.userList) { + await new Task(user).run(); + } +})() + .catch((e) => console.log(e)) + .finally(() => $.done()); + +async function getNotice() { + console.log(`1、此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 +2、由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。 +3、请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。 +4、此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。 +5、本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 +6、如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。 +7、所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此脚本,即视为您已接受此免责声明。`) + try { + let options = { + url: `https://ghproxy.net/https://raw.githubusercontent.com/smallfawn/Note/refs/heads/main/Notice.json`, + headers: { + "User-Agent": defaultUserAgent, + }, + timeout: 3000 + } + let { + data: res + } = await axios.request(options); + $.log(res) + return res + } catch (e) { } + +} \ No newline at end of file