修复分红bug ,优化运行逻辑

This commit is contained in:
yml2213
2022-05-29 23:12:02 +08:00
parent 31d2b11274
commit f80fd2e874
+39 -35
View File
@@ -15,6 +15,7 @@
* 5-17 修改运行次数
* 5-26 更新领取分红,更改荣誉值次数 每次执行10次
* 5-27 修复退出问题(测试中)
* 5-29 修复分红bug ,优化运行逻辑
*
*
* 感谢所有测试人员
@@ -28,14 +29,16 @@
*/
const $ = new Env("推了吗");
const notify = $.isNode() ? require("./sendNotify") : "";
const Notify = 1 //0为关闭通知,1为打开通知,默认为1
const debug = 0 //0为关闭调试,1为打开调试,默认为0
const Notify = 1 //0为关闭通知,1为打开通知,默认为1
const debug = 1 //0为关闭调试,1为打开调试,默认为0
///////////////////////////////////////////////////////////////////
let ckStr = process.env.tlm_data;
let msg = "";
let ck = "";
let ck_status = '';
let ad_status = 0;
let coin_status = 0;
let token = "";
///////////////////////////////////////////////////////////////////
@@ -61,10 +64,9 @@ async function tips(ckArr) {
console.log(`\n===============================================\n 脚本执行 - 北京时间(UTC+8): ${new Date(
new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000
).toLocaleString()} \n===============================================\n`);
await wyy();
// await wyy();
console.log(`\n================= 共找到 ${ckArr.length} 个账号 =================`);
msg += `\n================= 共找到 ${ckArr.length} 个账号 =================`
debugLog(`【debug】 这是你的账号数组:\n ${ckArr}`);
}
@@ -94,6 +96,17 @@ async function start() {
if (ck_status == 0) {
console.log(`\n开始 领取分红`);
console.log(`\n 开始 领取金币分红`);
await coin_Dividends();
console.log(`\n 开始 领取现金分红`);
await cash_Dividends();
console.log(`\n 开始 领取荣誉值分红`);
await honor_Dividends();
console.log("\n开始 用户信息");
await user_info();
@@ -108,25 +121,15 @@ async function start() {
}
console.log(`\n开始 阅读文章--领金币`);
for (let index = 1; index < 11; index++) {
console.log(` 开始 第 ${index} 次 阅读文章--领金币`);
await start_reading();
}
if (coin_status == 1) {
console.log(` 开始 第 ${index} 次 阅读文章--领金币`);
await start_reading();
} else {
console.log(` 今日广告金币已上限 ,请明日再来浏览吧!`);
}
console.log(`\n开始 领取分红`);
if (local_hours == 18) {
console.log(` 开始 领取金币分红`);
await coin_Dividends();
console.log(` 开始 领取现金分红`);
await cash_Dividends();
console.log(` 开始 领取荣誉值分红`);
await honor_Dividends();
} else {
console.log(` 领取分红默认每天18点领取 ,时间不对,跳过领取分红!`);
msg += `\n 领取分红默认每天18点领取 ,时间不对,跳过领取分红!`
}
}
}
@@ -255,12 +258,20 @@ async function start_reading() {
console.log(` 开始 领取阅读奖励`);
await article_coin();
} else if (result.code === 0) {
console.log(` 这篇文章读过了! 让我们跳过他!`);
await $.wait(20 * 1000);
await article_coin();
if (result.msg == "今日广告金币已上限,请明日再来浏览") {
console.log(` 开始阅读:${result.msg}`);
msg += `\n 开始阅读:${result.msg}`;
await $.wait(5 * 1000);
coin_status++;
} else {
console.log(` 开始阅读:这篇文章读过了 ,让我们跳过他!`);
msg += `\n 开始阅读:这篇文章读过了 ,让我们跳过他!`;
await $.wait(20 * 1000);
await article_coin();
}
} else {
console.log(` 开始阅读: 失败 ❌ 了呢,原因未知!`);
msg += `\n 开始阅读: 失败 ❌ 了呢,原因未知! `;
console.log(` 开始阅读: 失败 ❌ 了呢, 原因未知!`);
msg += `\n 开始阅读: 失败 ❌ 了呢, 原因未知! `;
}
}
@@ -270,7 +281,7 @@ async function start_reading() {
* http://tlm.zhixiang.run/api/coin/articleReadEnd
*/
async function article_coin() {
await article_list();
let url = {
url: `http://tlm.zhixiang.run/api/coin/articleReadEnd`,
headers: {
@@ -306,21 +317,15 @@ async function honor_ad() {
let result = await httpPost(url, `荣誉广告`);
if (result.code == 0) {
console.log(` 荣誉广告: 成功 ,开始阅读广告: ${result.data.title}`);
msg += `\n 荣誉广告: 成功 ,开始阅读广告: ${result.data.title}`;
honor_id = result.data.id;
let num = randomInt(20, 25);
console.log(` 等待 ${num} 秒后 领取荣誉值`);
await $.wait(num * 1000);
console.log(` 开始 领取荣誉值`);
await receive_honor();
} else if (result.code == 1) {
console.log(` 荣誉广告: ${result.msg}`);
msg += `\n 荣誉广告: ${result.msg}`;
ad_status++;
} else {
console.log(` 荣誉广告: 失败 ❌ 了呢,原因未知!`);
msg += `\n 荣誉广告: 失败 ❌ 了呢,原因未知! `;
@@ -372,6 +377,7 @@ async function receive_honor() {
let num = randomInt(20, 25);
console.log(` 等待 ${num} 秒后 结束阅读`);
await $.wait(num * 1000);
// 结束阅读文章
let url_read_end = {
@@ -408,7 +414,6 @@ async function receive_honor() {
}
if (honor_start < honor_end) {
console.log(` 领取荣誉值: 成功 ,本次获得荣誉值: ${result.data.drawNum}`);
msg += `\n 领取荣誉值: 成功 ,本次获得荣誉值: ${result.data.drawNum}`;
@@ -424,7 +429,6 @@ async function receive_honor() {
* 领取金币分红 httpPost
*/
async function coin_Dividends() {
let url = {
url: `http://tlm.zhixiang.run/api/newtask/fhSubmit`,
headers: {