mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-02-03 18:45:08 +08:00
Update smzdm_task.js
This commit is contained in:
@@ -6,7 +6,6 @@ cron: 20 14 * * *
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
const Env = require('./env');
|
const Env = require('./env');
|
||||||
const notify = require('./sendNotify');
|
const notify = require('./sendNotify');
|
||||||
|
|
||||||
@@ -18,21 +17,6 @@ const FOLLOW_USERS = [5874442461, 3050600933, 7466566467, 3028144837, 4573019331
|
|||||||
|
|
||||||
const $ = new Env('什么值得买任务');
|
const $ = new Env('什么值得买任务');
|
||||||
|
|
||||||
let cookiesArr = [];
|
|
||||||
|
|
||||||
// 判断环境变量里面是否有 cookie
|
|
||||||
if (process.env.SMZDM_COOKIE) {
|
|
||||||
if (process.env.SMZDM_COOKIE.indexOf('&') > -1) {
|
|
||||||
cookiesArr = process.env.SMZDM_COOKIE.split('&');
|
|
||||||
}
|
|
||||||
else if (process.env.SMZDM_COOKIE.indexOf('\n') > -1) {
|
|
||||||
cookiesArr = process.env.SMZDM_COOKIE.split('\n');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cookiesArr = [process.env.SMZDM_COOKIE];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const randomStr = (len = 18) => {
|
const randomStr = (len = 18) => {
|
||||||
const char = '0123456789';
|
const char = '0123456789';
|
||||||
let str = '';
|
let str = '';
|
||||||
@@ -710,32 +694,51 @@ class SmzdmBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
!(async () => {
|
!(async () => {
|
||||||
if (!cookiesArr[0]) {
|
let cookies = [];
|
||||||
|
|
||||||
|
// 判断环境变量里面是否有 cookie
|
||||||
|
if (process.env.SMZDM_COOKIE) {
|
||||||
|
if (process.env.SMZDM_COOKIE.indexOf('&') > -1) {
|
||||||
|
cookies = process.env.SMZDM_COOKIE.split('&');
|
||||||
|
}
|
||||||
|
else if (process.env.SMZDM_COOKIE.indexOf('\n') > -1) {
|
||||||
|
cookies = process.env.SMZDM_COOKIE.split('\n');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cookies = [process.env.SMZDM_COOKIE];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cookies[0]) {
|
||||||
$.log('\n请先设置 SMZDM_COOKIE 环境变量');
|
$.log('\n请先设置 SMZDM_COOKIE 环境变量');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let notifyContent = '';
|
let notifyContent = '';
|
||||||
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
if (cookiesArr[i]) {
|
const cookie = cookies[i];
|
||||||
if (i > 0) {
|
|
||||||
$.log('\n延迟 5 秒执行\n');
|
|
||||||
await $.wait(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
const cookie = cookiesArr[i];
|
if (!cookie) {
|
||||||
const sep = `\n******开始账号${i + 1}******\n`;
|
continue;
|
||||||
|
|
||||||
$.log(sep);
|
|
||||||
|
|
||||||
const bot = new SmzdmBot(cookie);
|
|
||||||
const msg = await bot.run();
|
|
||||||
|
|
||||||
$.log(msg + '\n');
|
|
||||||
|
|
||||||
notifyContent += sep + msg + '\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
$.log('\n延迟 5 秒执行\n');
|
||||||
|
await $.wait(5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
const sep = `\n******开始账号${i + 1}******\n`;
|
||||||
|
|
||||||
|
$.log(sep);
|
||||||
|
|
||||||
|
const bot = new SmzdmBot(cookie);
|
||||||
|
const msg = await bot.run();
|
||||||
|
|
||||||
|
$.log(msg + '\n');
|
||||||
|
|
||||||
|
notifyContent += sep + msg + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
await notify.sendNotify($.name, notifyContent);
|
await notify.sendNotify($.name, notifyContent);
|
||||||
|
|||||||
Reference in New Issue
Block a user