This commit is contained in:
jiahuigithub authored and GitHub committed 2025-12-08 09:31:49 +08:00
1 parent 943dc71095
commit 551b945e60
16 files changed
+5576 -8

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5071 -8
View File
File diff suppressed because it is too large. Load diff
+308
View File
@@ -0,0 +1,308 @@
/*
青龙脚本:星妈会自动任务 + 自动获取 cuk(通用 code_url)
作者:ChatGPT 整合最终版
环境变量:
soy_wxid_data → 多个 wxid,换行分隔
soy_codeurl_data → 通用 code 获取地址
流程:
wxid → 请求 code → 请求 autologin → 得到 cuk →
构造 XMH_COOKIE 内容执行星妈会任务
*/
const axios = require("axios");
const notify = require('./sendNotify');
// =======================
// 工具
// =======================
function sleep(ms){ return new Promise(res => setTimeout(res, ms)); }
function parseEnvList(name) {
const raw = process.env[name] || "";
return raw.split("\n").map(x => x.trim()).filter(x => x);
}
function parseEnvStr(name) {
return (process.env[name] || "").trim();
}
// =======================
// 第1步:读取环境变量
// =======================
const wxidList = parseEnvList("soy_wxid_data");
const codeUrl = parseEnvStr("soy_codeurl_data");
if (wxidList.length === 0 || !codeUrl) {
console.log("❌ 环境变量为空,请检查 soy_wxid_data 或 soy_codeurl_data");
process.exit(0);
}
console.log(`🟢 读取到 ${wxidList.length} 个账号`);
console.log(`🟢 通用 code_url: ${codeUrl}`);
// =======================
// 第2步:获取 code
// =======================
async function getCode(wxid) {
try {
const body = { appid: "wxc83b55d61c7fc51d", wxid };
const res = await axios.post(codeUrl, body, { timeout: 10000 });
if (res.data?.status && res.data?.Data?.code) {
console.log(`⭐ 获取 code 成功: ${wxid}`);
return res.data.Data.code;
}
} catch (e) {
console.log(`❌ 获取 code 失败:${wxid} →`, e.message);
}
return null;
}
// =======================
// 第3步:code → cuk
// =======================
async function getCuk(code){
const api = `https://momclub.feihe.com/pmall/c/login/autologin?code=${code}`;
try {
const res = await axios.get(api, {
headers: {
"cuk": "undefined",
"User-Agent": "Mozilla/5.0",
"Content-Type": "application/json"
},
timeout: 10000
});
if (res.data?.code === "000000") {
const cuk = res.data.data.cuk;
console.log(`🎉 cuk 获取成功`);
return cuk;
}
} catch (e) {
console.log(`❌ cuk 获取失败:`, e.message);
}
return null;
}
// =======================
// 构造最终 XMH_COOKIE 列表
// =======================
async function buildCookieList() {
const result = [];
for (let i=0;i<wxidList.length;i++){
const wxid = wxidList[i];
console.log(`\n========== 账号 ${i+1} ==========`);
const code = await getCode(wxid);
if (!code) continue;
await sleep(1500);
const cuk = await getCuk(code);
if (!cuk) continue;
result.push(`${cuk}#${wxid}`);
await sleep(2000);
}
return result;
}
// =======================
// 星妈会任务类
// =======================
const API_HOST = "https://momclub.feihe.com";
function init() {
return {
isNode: () => true,
http: axios,
wait: (ms) => new Promise(resolve => setTimeout(resolve, ms)),
log: console.log
};
}
const $ = init();
class XingMaHui {
constructor(cuk, index, remark='') {
this.cuk = cuk;
this.index = index;
this.remark = remark;
this.accountName = remark ? `账号${index}(${remark})` : `账号${index}`;
this.creditsEarned = 0;
this.taskResults = [];
this.userInfo = null;
this.initialPoints = 0;
this.finalPoints = 0;
}
getHeaders(){
return {
'Host': 'momclub.feihe.com',
'cuk': this.cuk,
'User-Agent': 'Mozilla/5.0',
'Content-Type': 'application/json'
};
}
async request(url, method="GET", data=null){
try {
const config = { headers: this.getHeaders(), timeout: 10000 };
let res = null;
if (method === "GET") {
res = await $.http.get(url, config);
} else {
res = await $.http.post(url, data, config);
}
return res.data;
} catch (e) {
console.log("❌ 请求异常:", e.message);
return null;
}
}
async getUserInfo(){
const url = `${API_HOST}/pmall/c/user/memberInfo`;
const r = await this.request(url);
if (r?.code === "000000") {
this.userInfo = r.data;
return r.data;
}
return null;
}
async getTaskList(){
const url = `${API_HOST}/pmall/c/activity/todo/list?mockTime=${Date.now()}`;
const r = await this.request(url);
if (r?.code === "000000") return r.data;
return null;
}
async queryTaskCredits(name){
const url = `${API_HOST}/pmall/c/activity/todo/queryTodoResult`;
const r = await this.request(url);
if (r?.code === "000000") {
const t = r.data.find(x => x.taskName === name);
return t?.actualCredits || 0;
}
return 0;
}
async doCheckIn(id, name){
const url = `${API_HOST}/pmall/c/activity/todo/checkIn`;
const data = { activityId:id, mockTime: Date.now() };
console.log(`➡ 签到:${name}`);
const r = await this.request(url, "POST", data);
if (r?.code === "000000") {
const c = r.data.credits || 1;
this.creditsEarned += c;
this.taskResults.push(`签到 ${name} +${c}`);
}
}
async doNormalTask(id, name){
console.log(`➡ 普通任务:${name}`);
const r1 = await this.request(`${API_HOST}/pmall/c/activity/todo/receive`, "POST",
{activityId:id, mockTime:Date.now()}
);
if (r1?.code !== "000000") return;
await $.wait(1000);
const r2 = await this.request(`${API_HOST}/pmall/c/activity/todo/complete`, "POST",
{activityId:id, mockTime:Date.now()}
);
if (r2?.code !== "000000") return;
await $.wait(1000);
const credits = await this.queryTaskCredits(name);
this.creditsEarned += credits;
this.taskResults.push(`${name} +${credits}`);
}
async doAllTasks(){
console.log(`\n⭐ 开始执行 ${this.accountName}`);
await this.getUserInfo();
if (this.userInfo) this.initialPoints = this.userInfo.points;
const list = await this.getTaskList();
if (!list) return;
if (list.checkInTodo) await this.doCheckIn(list.checkInTodo.id, list.checkInTodo.name);
if (list.taskTodo) {
for (const t of list.taskTodo) {
const type = t.taskTodoExtra?.type;
if (type === "AddQw" || type === "FirstOrder") continue;
await this.doNormalTask(t.id, t.name);
}
}
await this.getUserInfo();
if (this.userInfo) this.finalPoints = this.userInfo.points;
}
getResults(){
return {
account: this.accountName,
initial: this.initialPoints,
final: this.finalPoints,
gained: this.creditsEarned,
tasks: this.taskResults,
user: this.userInfo
};
}
}
// =======================
// 主执行
// =======================
(async () => {
console.log("\n🚀 开始获取 cuk ...\n");
const cookieList = await buildCookieList();
if (cookieList.length === 0) {
console.log("❌ 无法获取任何 cuk,退出");
return;
}
console.log(`\n⭐ 总共获取 ${cookieList.length} 个 cuk\n`);
const allAccounts = [];
let totalCredits = 0;
for (let i=0;i<cookieList.length;i++){
const [cuk, remark] = cookieList[i].split("#");
const acc = new XingMaHui(cuk, i+1, remark);
allAccounts.push(acc);
}
console.log("🚀 开始执行星妈会任务...\n");
for (const acc of allAccounts){
await acc.doAllTasks();
totalCredits += acc.creditsEarned;
await sleep(3000);
}
// 汇总结果
let msg = "🎉 星妈会任务完成\n\n";
for (const acc of allAccounts){
const r = acc.getResults();
msg += `📍 ${r.account}
手机号:${r.user?.mobile || "未知"}
初始积分:${r.initial}
最终积分:${r.final}
本次获得:${r.gained}
任务:
${r.tasks.map(t=>" - "+t).join("\n")}
-------------------\n`;
}
msg += `\n⭐ 今日总积分:${totalCredits}`;
console.log(msg);
await notify.sendNotify("星妈会任务完成", msg);
})();
+197
View File
@@ -0,0 +1,197 @@
# -*- coding: utf-8 -*-
# @Time : 2025-11-28
# @Author : chmodxxoo(整合版本)
# @Version :4.1
# @Desc : 蒙娜丽莎小程序:自动获取token → 自动签到,一体化脚本(日志调试 + 精简推送)
import os
import time
import random
import requests
try:
from notify import send
except ImportError:
print("未找到 notify.py,将仅在控制台输出日志。")
def send(title, content):
print(f"--- 通知 ---\n{title}\n{content}\n-------------")
# ======================================================
# 第 1 部分:获取 code → tokenStr
# ======================================================
ENV_NAMES = {
"wxid": "soy_wxid_data",
"code_url": "soy_codeurl_data"
}
message_list = []
def get_env(name):
v = os.getenv(name, "").strip()
if not v:
message_list.append(f"❌ 环境变量[{name}]为空!")
return None
#message_list.append(f"✅ 成功读取环境变量[{name}]")
return v
def get_wxid_list():
data = get_env(ENV_NAMES["wxid"])
if not data:
return []
return [x.strip() for x in data.split("\n") if x.strip()]
def get_code(wxid, code_url):
"""用 wxid 换取 code"""
headers = {"Content-Type": "application/json"}
payload = {"appid": "wxce6a8f654e81b7a4", "wxid": wxid}
try:
r = requests.post(code_url, json=payload, headers=headers, timeout=15).json()
if r.get("status") is True:
code = r.get("Data", {}).get("code")
if code:
print(f"[INFO] wxid[{wxid}] 获取 code 成功")
return code
except Exception as e:
print(f"[ERROR] wxid[{wxid}] 获取 code 失败:{e}")
return None
def get_customer_token(code):
"""调用 doAction 获取 CustomerID + tokenStr"""
url = "https://mcs.monalisagroup.com.cn/member/doAction"
headers = {
'Accept-Encoding': 'gzip,compress,br,deflate',
'content-type': 'application/x-www-form-urlencoded',
'Connection': 'keep-alive',
'Referer': 'https://servicewechat.com/wxce6a8f654e81b7a4/462/page-frame.html',
'Host': 'mcs.monalisagroup.com.cn',
'User-Agent': 'Mozilla/5.0'
}
data = (
f"brand=MON&webChatName=%E5%BE%AE%E4%BF%A1%E7%94%A8%E6%88%B7&telephone=&code={code}&remarks=&action=addCustomer"
f"&customerName=%E5%BE%AE%E4%BF%A1%E7%94%A8%E6%88%B7&storeID=&address=-&Province=&City=&Region="
)
try:
r = requests.post(url, headers=headers, data=data, timeout=15).json()
if "tokenStr" in r and r.get("resultInfo"):
customer_id = r["resultInfo"][0]["CustomerID"]
tokenStr = r["tokenStr"]
print(f"[INFO] 获取成功:CustomerID={customer_id} tokenStr={tokenStr}")
return f"{customer_id}#{tokenStr}"
except Exception as e:
print(f"[ERROR] 获取 tokenStr 失败:{e}")
return None
# ======================================================
# 第 2 部分:签到模块
# ======================================================
class MNLS:
def __init__(self, index, account):
self.index = index
self.customerId, self.tokenStr = account.split("#")
self.mobile = ""
self.score = 0
self.msg = ""
self.headers = {
"Host": "mcs.monalisagroup.com.cn",
"Connection": "keep-alive",
"User-Agent": "Mozilla/5.0",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://servicewechat.com/wxce6a8f654e81b7a4/462/page-frame.html",
"Accept-Encoding": "gzip,compress,br,deflate"
}
def hide_phone(self, phone):
if not phone or len(phone) != 11:
return phone
return phone[:3] + "****" + phone[7:]
def get_info(self):
url = "https://mcs.monalisagroup.com.cn/member/doAction"
data = f"brand=MON&customerID={self.customerId}&action=getCustInfoByID"
try:
r = requests.post(url, headers=self.headers, data=data).json()
if r.get("status") == 0:
info = r["resultInfo"][0]
self.mobile = self.hide_phone(info["Telephone"])
self.score = info["Integral"]
print(f"[INFO] 账号{self.index} 信息获取成功:手机号={self.mobile} 积分={self.score}")
return True
except Exception as e:
print(f"[ERROR] 账号{self.index} 获取信息失败:{e}")
return False
def sign(self):
url = "https://mcs.monalisagroup.com.cn/member/doAction"
data = (
f"brand=MON&action=sign&CustomerID={self.customerId}&CustomerName=%E5%BE%AE%E4%BF%A1%E7%94%A8%E6%88%B7&"
f"StoreID=0&OrganizationID=0&ItemType=002&Brand=MON&tokenStr={self.tokenStr}"
)
try:
r = requests.post(url, headers=self.headers, data=data).json()
if r.get("status") == 0:
self.msg = f"签到成功,获得积分:{r.get('resultInfo')}"
elif r.get("status") == 7:
self.msg = "今天已经签到过了"
else:
self.msg = f"签到失败:{r}"
print(f"[INFO] 账号{self.index} 签到状态:{self.msg}")
except Exception as e:
self.msg = f"签到异常:{e}"
print(f"[ERROR] 账号{self.index} 签到异常:{e}")
def run(self):
self.get_info()
self.sign()
self.get_info() # 更新积分
return f"账号{self.index} → {self.msg},积分:{self.score}"
# ======================================================
# 主流程整合
# ======================================================
if __name__ == "__main__":
code_url = get_env(ENV_NAMES["code_url"])
wxid_list = get_wxid_list()
if not code_url or not wxid_list:
print("\n".join(message_list))
exit(0)
account_list = []
print("\n===== 开始获取 CustomerID#tokenStr =====")
for wxid in wxid_list:
code = get_code(wxid, code_url)
if not code:
continue
account = get_customer_token(code)
if account:
account_list.append(account)
time.sleep(random.uniform(1, 2))
if not account_list:
print("❌ 未获取到任何账号 tokenStr")
exit(0)
# ======================================================
# 进入自动签到
# ======================================================
print("\n===== 开始签到 =====")
msg_final = []
for idx, acc in enumerate(account_list, start=1):
result = MNLS(idx, acc).run()
msg_final.append(result)
time.sleep(random.uniform(2, 4))
# 控制台输出完整日志
output = "\n".join(message_list + msg_final)
print(output)
# 最终推送:只包含签到结果和积分
send("蒙娜丽莎自动签到结果", "\n".join(msg_final))