mirror of
https://github.com/hlt1995/qlScripts.git
synced 2026-11-05 23:26:44 +08:00
Create winona.js
This commit is contained in:
1 parent
7ab1de8402
commit
27ea1333c7
1 file changed
+289
@@ -0,0 +1,289 @@
|
||||
//name: 薇诺娜小薇森林
|
||||
//cron: 15 12 * * *
|
||||
|
||||
/*
|
||||
微信小程序:薇诺娜专柜商城
|
||||
|
||||
首次跑需要点击首页右侧"小游戏"
|
||||
奖品:种树换实物
|
||||
|
||||
功能:
|
||||
双签到、种树任务、自动浇水
|
||||
|
||||
抓包:
|
||||
1. 抓域名api.qiumeiapp.com请求体中的appUserToken值
|
||||
2. export wnn_ck="appUserToken"
|
||||
updata:
|
||||
2025.03.04
|
||||
*/
|
||||
|
||||
const axios = require("axios");
|
||||
const wnn = process.env.wnn_ck || "";
|
||||
|
||||
let notifyMessages = [];
|
||||
|
||||
function addNotifyMessage(message) {
|
||||
if (message && !notifyMessages.includes(message)) {
|
||||
notifyMessages.push(message);
|
||||
}
|
||||
}
|
||||
|
||||
async function sendNotify() {
|
||||
if (notifyMessages.length > 0) {
|
||||
try {
|
||||
const notify = require('./sendNotify');
|
||||
const title = "🔔薇诺娜任务通知";
|
||||
const content = notifyMessages.join('\n');
|
||||
notify.sendNotify(title, content);
|
||||
console.log(`📤 已发送通知: ${notifyMessages.length} 条消息`);
|
||||
} catch (error) {
|
||||
console.log("❌ 发送通知失败:", error.message);
|
||||
}
|
||||
} else {
|
||||
console.log("✅ 无需发送通知");
|
||||
}
|
||||
}
|
||||
|
||||
function log(message) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
// 延迟函数
|
||||
function delay() {
|
||||
return new Promise(resolve => setTimeout(resolve, 7000));
|
||||
}
|
||||
|
||||
class WnnTask {
|
||||
constructor(token, index) {
|
||||
this.appUserToken = token.trim();
|
||||
this.index = index + 1;
|
||||
this.username = `账号 ${this.index}`;
|
||||
this.baseUrl = "https://api.qiumeiapp.com/zg-activity/zg-daily/";
|
||||
this.headers = {
|
||||
Host: "api.qiumeiapp.com",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.56(0x18003830) NetType/WIFI Language/zh_CN",
|
||||
Referer: "https://servicewechat.com/wx250394ab3f680bfa/637/page-frame.html",
|
||||
Connection: "keep-alive"
|
||||
};
|
||||
this.hasCriticalError = false;
|
||||
}
|
||||
|
||||
async checkin() {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.baseUrl}zgSigninNew`,
|
||||
`appUserToken=${this.appUserToken}`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
|
||||
log(`\n====== ${this.username} ======`);
|
||||
|
||||
switch (response.data.code) {
|
||||
case 703:
|
||||
log("✅ 今日已签到!");
|
||||
break;
|
||||
case 200:
|
||||
log("✅ 签到成功!");
|
||||
break;
|
||||
case 600:
|
||||
const tokenErrorMsg = `❌ ${this.username} Token 失效,请重新获取!`;
|
||||
log(tokenErrorMsg);
|
||||
addNotifyMessage(tokenErrorMsg);
|
||||
this.hasCriticalError = true;
|
||||
return false;
|
||||
default:
|
||||
const signErrorMsg = `❌ ${this.username} 签到失败: ${JSON.stringify(response.data)}`;
|
||||
log(signErrorMsg);
|
||||
addNotifyMessage(signErrorMsg);
|
||||
this.hasCriticalError = true;
|
||||
return false;
|
||||
}
|
||||
} catch (error) {
|
||||
const requestErrorMsg = `❌ ${this.username} 签到请求异常: ${error.message}`;
|
||||
log(requestErrorMsg);
|
||||
addNotifyMessage(requestErrorMsg);
|
||||
this.hasCriticalError = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async treeCheckin() {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.baseUrl}signinZgForest`,
|
||||
`appUserToken=${this.appUserToken}`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
|
||||
if (response.data.code === 200) {
|
||||
log(`🌳 树木签到成功,获得 ${response.data.data.waterGram}g 水滴`);
|
||||
} else {
|
||||
log(`❌ 树木签到失败: ${JSON.stringify(response.data)}`);
|
||||
}
|
||||
} catch (error) {
|
||||
log(`❌ 树木签到请求异常: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async assist(shareCode) {
|
||||
try {
|
||||
await axios.post(
|
||||
`${this.baseUrl}addZgForestInvite`,
|
||||
`appUserToken=${this.appUserToken}&sysCode=zgxcx&isRegister=1&userShareCode=${shareCode}`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
} catch (error) {
|
||||
// 静默处理异常
|
||||
}
|
||||
}
|
||||
|
||||
async browseMall() {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.baseUrl}updateZgForestTask`,
|
||||
`appUserToken=${this.appUserToken}&taskCode=2025001`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
|
||||
if (response.data.code === 200) {
|
||||
log("✅ 浏览商城任务完成!");
|
||||
} else {
|
||||
log(`❌ 浏览商城失败: ${JSON.stringify(response.data)}`);
|
||||
}
|
||||
} catch (error) {
|
||||
log(`❌ 浏览商城请求异常: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async readArticle() {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.baseUrl}updateZgForestTask`,
|
||||
`appUserToken=${this.appUserToken}&taskCode=2025002`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
|
||||
if (response.data.code === 200) {
|
||||
log("✅ 阅读文章任务完成!");
|
||||
} else if (response.data.code === 703) {
|
||||
log("⚠️ 请勿频繁操作!");
|
||||
} else {
|
||||
log(`❌ 阅读文章失败: ${JSON.stringify(response.data)}`);
|
||||
}
|
||||
} catch (error) {
|
||||
log(`❌ 阅读文章请求异常: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async getWaterDrops() {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.baseUrl}getZgForest`,
|
||||
`appUserToken=${this.appUserToken}`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
|
||||
if (response.data.code === 200) {
|
||||
const waterDrops = response.data.data.remainWaterGram;
|
||||
log(`💧 当前水滴数量: ${waterDrops}g`);
|
||||
return waterDrops;
|
||||
} else {
|
||||
log(`❌ 获取水滴失败: ${JSON.stringify(response.data)}`);
|
||||
}
|
||||
} catch (error) {
|
||||
log(`❌ 获取水滴请求异常: ${error.message}`);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
async waterTree() {
|
||||
const waterDrops = await this.getWaterDrops();
|
||||
const waterTimes = Math.floor(waterDrops / 10);
|
||||
|
||||
if (waterTimes <= 0) {
|
||||
log("❌ 水滴不足,无法浇水!");
|
||||
return;
|
||||
}
|
||||
|
||||
log(`🌿 计划浇水 ${waterTimes} 次...`);
|
||||
|
||||
for (let i = 1; i <= waterTimes; i++) {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${this.baseUrl}wateringZgForest`,
|
||||
`appUserToken=${this.appUserToken}`,
|
||||
{ headers: this.headers }
|
||||
);
|
||||
|
||||
if (response.data.code === 200) {
|
||||
log(`✅ 第 ${i} 次浇水成功!`);
|
||||
} else {
|
||||
log(`❌ 浇水失败: ${JSON.stringify(response.data)}`);
|
||||
}
|
||||
} catch (error) {
|
||||
log(`❌ 浇水请求异常: ${error.message}`);
|
||||
}
|
||||
await delay();
|
||||
}
|
||||
}
|
||||
|
||||
async run(shareCode) {
|
||||
if (!(await this.checkin())) return;
|
||||
|
||||
await delay();
|
||||
await this.treeCheckin();
|
||||
await delay();
|
||||
await this.assist(shareCode);
|
||||
await delay();
|
||||
await this.browseMall();
|
||||
await delay();
|
||||
await this.readArticle();
|
||||
await delay();
|
||||
await this.waterTree();
|
||||
}
|
||||
}
|
||||
|
||||
// 主函数
|
||||
(async () => {
|
||||
console.log("薇诺娜专柜商城 v1.0.0");
|
||||
|
||||
if (!wnn) {
|
||||
const noTokenMsg = "❌ 未找到环境变量 wnn_ck 变量!";
|
||||
console.log(noTokenMsg);
|
||||
addNotifyMessage(noTokenMsg);
|
||||
await sendNotify();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const tokens = wnn.split("&")
|
||||
.map(token => token.trim())
|
||||
.filter(token => token);
|
||||
|
||||
if (tokens.length > 0) {
|
||||
console.log(`\n共获取到 ${tokens.length} 个账号`);
|
||||
const shareCode = "48d96b20";
|
||||
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
const task = new WnnTask(tokens[i], i);
|
||||
await task.run(shareCode);
|
||||
|
||||
// 每个任务完成后延迟一下
|
||||
if (i < tokens.length - 1) {
|
||||
await delay();
|
||||
}
|
||||
}
|
||||
|
||||
console.log("\n====== 任务完成 ======");
|
||||
|
||||
// 发送通知
|
||||
await sendNotify();
|
||||
} else {
|
||||
const noValidTokenMsg = "❌ 未找到有效的 appUserToken,退出。";
|
||||
console.log(noValidTokenMsg);
|
||||
addNotifyMessage(noValidTokenMsg);
|
||||
await sendNotify();
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user