mirror of
https://github.com/hex-ci/smzdm_script.git
synced 2026-11-03 14:16:57 +08:00
Update smzdm_lottery.js
This commit is contained in:
@@ -22,49 +22,50 @@ if (process.env.SMZDM_COOKIE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
!(async () => {
|
!(async () => {
|
||||||
if (!cookiesArr[0]) {
|
if (!cookiesArr[0]) {
|
||||||
$.msg($.name, '请先设置 SMZDM_COOKIE 环境变量');
|
$.msg($.name, '请先设置 SMZDM_COOKIE 环境变量');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let notifyContent = '';
|
let notifyContent = '';
|
||||||
|
|
||||||
for (let i = 0; i < cookiesArr.length; i++) {
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
if (cookiesArr[i]) {
|
if (cookiesArr[i]) {
|
||||||
const cookie = cookiesArr[i];
|
if (i > 0) {
|
||||||
|
$.log('\n延时 5 秒执行\n');
|
||||||
|
await $.wait(5000)
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`\n******开始账号${i + 1}*********\n`);
|
const cookie = cookiesArr[i];
|
||||||
|
const sep = `\n******开始账号${i + 1}******\n`;
|
||||||
|
|
||||||
const msg = await lottery(cookie);
|
const msg = await lottery(cookie);
|
||||||
|
|
||||||
notifyContent += msg;
|
notifyContent += sep + msg + "\n";
|
||||||
|
|
||||||
$.msg(msg);
|
$.log(sep + msg + "\n");
|
||||||
|
}
|
||||||
await $.wait(5000)
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await notify.sendNotify($.name, notifyContent);
|
await notify.sendNotify($.name, notifyContent);
|
||||||
})()
|
})()
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
$.done();
|
$.done();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
// 每日抽奖
|
// 每日抽奖
|
||||||
async function lottery(cookie) {
|
async function lottery(cookie) {
|
||||||
let activeId = "";
|
let activeId = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await $.http.get({
|
const resp = await $.http.get({
|
||||||
url: "https://m.smzdm.com/zhuanti/life/choujiang/",
|
url: "https://m.smzdm.com/zhuanti/life/choujiang/",
|
||||||
headers: {
|
headers: {
|
||||||
Accept:
|
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||||
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br",
|
"Accept-Encoding": "gzip, deflate, br",
|
||||||
"Accept-Language": "zh-cn",
|
"Accept-Language": "zh-cn",
|
||||||
Connection: "keep-alive",
|
Connection: "keep-alive",
|
||||||
@@ -109,9 +110,9 @@ async function lottery(cookie) {
|
|||||||
return "每日抽奖失败,接口响应异常";
|
return "每日抽奖失败,接口响应异常";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (error) {
|
||||||
catch (error) {
|
|
||||||
$.log(`每日抽奖失败,${error}`);
|
$.log(`每日抽奖失败,${error}`);
|
||||||
|
return "每日抽奖失败,接口响应异常";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user