Compare commits
13 Commits
f8e47879f1
...
main
Author | SHA1 | Date | |
---|---|---|---|
78733375ce
|
|||
c0b46611e4
|
|||
6025465912
|
|||
a94550b01d
|
|||
1c21596315
|
|||
ef7235c006
|
|||
88d4474728
|
|||
1119581d19
|
|||
15ca17e903
|
|||
41280019f6
|
|||
6bcb19e8e1
|
|||
ee3321c7e8
|
|||
2dbcab998f
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
configs/
|
||||
node_modules/
|
||||
pnpm-lock.yaml
|
||||
yarn.lock
|
||||
yarn.lock
|
||||
.vscode/
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 HuanLinMaster
|
||||
Copyright (c) 2022-2023 HuanLinMaster, earthjasonlin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
12
README.md
12
README.md
@ -1,18 +1,18 @@
|
||||
# Genshin Cloud Game Helper
|
||||
# Hoyo Cloud Game Helper
|
||||
|
||||

|
||||

|
||||
|
||||
[《云·原神》](https://mhyy.mihoyo.com/)自动签到脚本
|
||||
[米哈云游](https://mhyy.mihoyo.com/)自动签到脚本
|
||||
|
||||
**⚠️ 请不要进行宣传,谢谢!一旦发现宣传就跑路!**
|
||||
|
||||
这是一个可以帮助你每天自动进行云原神签到的脚本,自动获取每日的 15 分钟(600 分钟后无法获取)
|
||||
这是一个可以帮助你每天自动进行云原神、云绝区零签到的脚本,自动获取每日的 15 分钟(600 分钟后无法获取)
|
||||
|
||||
## 赞助
|
||||
|
||||
点击下面的 Badge 其中一个就可以跳转到相应页面,感谢老板的支持!
|
||||
|
||||
<a href="https://afdian.net/a/earthjasonlin"><img src="https://img.shields.io/badge/%E7%88%B1%E5%8F%91%E7%94%B5-earthjasonlin-%238e8cd8?style=for-the-badge" alt="前往爱发电赞助" width=auto height=auto border="0" /></a> <a href="https://dist.loliquq.cn/d/wechat-reward-code.jpeg"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1%E6%94%AF%E4%BB%98-earthjasonlin-%2304BE02?style=for-the-badge" alt="使用微信赞助" width=auto height=auto border="0" /></a>
|
||||
<a href="https://afdian.net/a/earthjasonlin"><img src="https://img.shields.io/badge/%E7%88%B1%E5%8F%91%E7%94%B5-earthjasonlin-%238e8cd8?style=for-the-badge" alt="前往爱发电赞助" width=auto height=auto border="0" /></a>
|
||||
|
||||
## 免责声明
|
||||
|
||||
@ -28,4 +28,4 @@
|
||||
|
||||
## Stargazers over time
|
||||
|
||||
[](https://starchart.cc/earthjasonlin/GenshinCloudGameHelper)
|
||||
[](https://starchart.cc/earthjasonlin/HoyoCloudGameHelper)
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "genshincloudgamehelpper",
|
||||
"name": "genshincloudgamehelper",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "genshincloudgamehelpper",
|
||||
"name": "genshincloudgamehelper",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
10
package.json
10
package.json
@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "genshincloudgamehelpper",
|
||||
"name": "genshincloudgamehelper",
|
||||
"version": "1.0.0",
|
||||
"description": "每天帮你获取15分钟云原神时间~",
|
||||
"main": "index.js",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/HuanLinMaster/GenshinCloudGameHelpper.git"
|
||||
"url": "git+https://git.loliquq.cn/earthjasonlin/GenshinCloudGameHelper.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/HuanLinMaster/GenshinCloudGameHelpper/issues"
|
||||
"url": "https://git.loliquq.cn/earthjasonlin/GenshinCloudGameHelper/issues"
|
||||
},
|
||||
"homepage": "https://github.com/HuanLinMaster/GenshinCloudGameHelpper#readme",
|
||||
"homepage": "https://git.loliquq.cn/earthjasonlin/GenshinCloudGameHelper#readme",
|
||||
"dependencies": {
|
||||
"axios": "^1.5.0",
|
||||
"nodemailer": "^6.7.6",
|
||||
|
172
src/config.js
172
src/config.js
@ -3,56 +3,86 @@ const fs = require("fs");
|
||||
const { default: axios } = require("axios");
|
||||
const { log } = require("./util");
|
||||
|
||||
exports.ListNotificationURL =
|
||||
// Updated on 2025/06/29 Windows client 5.7.0
|
||||
exports.hk4e_ListNotificationURL =
|
||||
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?is_sort=true&source=NotificationSourceUnknown&status=NotificationStatusUnread&type=NotificationTypePopup";
|
||||
exports.AckNotificationURL =
|
||||
exports.hk4e_AckNotificationURL =
|
||||
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification";
|
||||
exports.WalletURL =
|
||||
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get?cost_method=COST_METHOD_UNSPECIFIED";
|
||||
exports.AnnouncementURL =
|
||||
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo";
|
||||
// Here must be an earlier version so that the response won't be null
|
||||
exports.AppVersionURL =
|
||||
"https://api-takumi.mihoyo.com/ptolemaios/api/getLatestRelease?app_id=1953443910&app_version=3.8.0&channel=mihoyo";
|
||||
exports.hk4e_WalletURL =
|
||||
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get?cost_method=COST_METHOD_UNSPECIFIED&get_type=GET_TYPE_DEFAULT";
|
||||
exports.hk4e_AppVersionURL =
|
||||
"https://api-takumi.mihoyo.com/ptolemaios_api/api/getLatestRelease?app_id=1953443910&app_version=5.6.0&channel=cypcweb";
|
||||
|
||||
exports.ListNotification = async function (header) {
|
||||
// Updated on 2025/06/29 Windows client 2.0.1
|
||||
exports.nap_ListNotificationURL =
|
||||
"https://cg-nap-api.mihoyo.com/nap_cn/cg/gamer/api/listNotifications?is_sort=true&source=NotificationSourceUnknown&status=NotificationStatusUnread&type=NotificationTypeObvious";
|
||||
exports.nap_AckNotificationURL =
|
||||
"https://cg-nap-api.mihoyo.com/nap_cn/cg/gamer/api/ackNotification";
|
||||
exports.nap_WalletURL =
|
||||
"https://cg-nap-api.mihoyo.com/nap_cn/cg/wallet/wallet/get?cost_method=COST_METHOD_UNSPECIFIED&get_type=GET_TYPE_DEFAULT";
|
||||
exports.nap_AppVersionURL =
|
||||
"https://api-takumi.mihoyo.com/ptolemaios_api/api/getLatestRelease?app_id=1953461632&app_version=2.0.0&channel=mihoyo";
|
||||
|
||||
exports.hk4e_ListNotification = async function (header) {
|
||||
let tmp = (
|
||||
await axios(exports.ListNotificationURL, {
|
||||
await axios(exports.hk4e_ListNotificationURL, {
|
||||
headers: header,
|
||||
})
|
||||
).data;
|
||||
tmp.StringVersion = JSON.stringify(tmp);
|
||||
return tmp;
|
||||
};
|
||||
exports.AckNotification = async function (header, id) {
|
||||
exports.nap_ListNotification = async function (header) {
|
||||
let tmp = (
|
||||
await axios(exports.nap_ListNotificationURL, {
|
||||
headers: header,
|
||||
})
|
||||
).data;
|
||||
tmp.StringVersion = JSON.stringify(tmp);
|
||||
return tmp;
|
||||
};
|
||||
exports.hk4e_AckNotification = async function (header, id) {
|
||||
let data = `{"id":"${id}"}`;
|
||||
await axios.post(exports.AckNotificationURL, data, {
|
||||
await axios.post(exports.hk4e_AckNotificationURL, data, {
|
||||
headers: header,
|
||||
});
|
||||
};
|
||||
exports.Wallet = async function (header) {
|
||||
exports.nap_AckNotification = async function (header, id) {
|
||||
let data = `{"id":"${id}"}`;
|
||||
await axios.post(exports.nap_AckNotificationURL, data, {
|
||||
headers: header,
|
||||
});
|
||||
};
|
||||
exports.hk4e_Wallet = async function (header) {
|
||||
let tmp = (
|
||||
await axios(exports.WalletURL, {
|
||||
await axios(exports.hk4e_WalletURL, {
|
||||
headers: header,
|
||||
})
|
||||
).data;
|
||||
tmp.StringVersion = JSON.stringify(tmp);
|
||||
return tmp;
|
||||
};
|
||||
exports.Announcement = async function (header) {
|
||||
exports.nap_Wallet = async function (header) {
|
||||
let tmp = (
|
||||
await axios(exports.AnnouncementURL, {
|
||||
await axios(exports.nap_WalletURL, {
|
||||
headers: header,
|
||||
})
|
||||
).data;
|
||||
tmp.StringVersion = JSON.stringify(tmp);
|
||||
return tmp;
|
||||
};
|
||||
exports.AppVersion = async function () {
|
||||
let tmp = (await axios(exports.AppVersionURL)).data;
|
||||
|
||||
exports.hk4e_AppVersion = async function () {
|
||||
let tmp = (await axios(exports.hk4e_AppVersionURL)).data;
|
||||
tmp.StringVersion = JSON.stringify(tmp);
|
||||
return tmp;
|
||||
};
|
||||
exports.nap_AppVersion = async function () {
|
||||
let tmp = (await axios(exports.nap_AppVersionURL)).data;
|
||||
tmp.StringVersion = JSON.stringify(tmp);
|
||||
return tmp;
|
||||
};
|
||||
|
||||
var configKeys = [
|
||||
"token",
|
||||
"client_type",
|
||||
@ -67,38 +97,64 @@ exports.getGlobalConfig = function () {
|
||||
var globalConfig = fs.readFileSync("global.json");
|
||||
} catch (e) {
|
||||
if (e.toString().includes("Error: ENOENT: no such file or directory")) {
|
||||
log.error(`读取配置失败!找不到全局配置文件`);
|
||||
log.error(`读取配置失败!找不到全局配置文件`);
|
||||
} else {
|
||||
log.error(`读取配置失败!错误信息:${e}`);
|
||||
log.error(`读取配置失败!错误信息:${e}`);
|
||||
}
|
||||
exit();
|
||||
}
|
||||
return JSON.parse(globalConfig);
|
||||
};
|
||||
|
||||
exports.getConfigs = function () {
|
||||
exports.hk4e_getConfigs = function () {
|
||||
try {
|
||||
var configsList = fs.readdirSync("configs");
|
||||
var configsList = fs.readdirSync("configs/hk4e");
|
||||
configsList = configsList.filter((file) => file.endsWith(".json"));
|
||||
} catch (e) {
|
||||
if (
|
||||
e == "Error: ENOENT: no such file or directory, scandir 'configs'"
|
||||
) {
|
||||
log.error(`读取配置失败!找不到configs文件夹`);
|
||||
log.error(`读取配置失败!找不到configs/hk4e文件夹`);
|
||||
} else {
|
||||
log.error(`读取配置失败!错误信息:${e}`);
|
||||
log.error(`读取配置失败!错误信息:${e}`);
|
||||
}
|
||||
exit();
|
||||
}
|
||||
log.info(`检测到${configsList.length}个配置文件:`);
|
||||
log.info(`检测到${configsList.length}个原神配置文件:`);
|
||||
configsList.forEach((file) => {
|
||||
log.info(`${file}`);
|
||||
});
|
||||
var configs = {};
|
||||
configsList.forEach((file) => {
|
||||
configs[file] = JSON.parse(fs.readFileSync(`configs/${file}`));
|
||||
configs[file] = JSON.parse(fs.readFileSync(`configs/hk4e/${file}`));
|
||||
});
|
||||
return configs;
|
||||
};
|
||||
exports.nap_getConfigs = function () {
|
||||
try {
|
||||
var configsList = fs.readdirSync("configs/nap");
|
||||
configsList = configsList.filter((file) => file.endsWith(".json"));
|
||||
} catch (e) {
|
||||
if (
|
||||
e == "Error: ENOENT: no such file or directory, scandir 'configs'"
|
||||
) {
|
||||
log.error(`读取配置失败!找不到configs/nap文件夹`);
|
||||
} else {
|
||||
log.error(`读取配置失败!错误信息:${e}`);
|
||||
}
|
||||
exit();
|
||||
}
|
||||
log.info(`检测到${configsList.length}个绝区零配置文件:`);
|
||||
configsList.forEach((file) => {
|
||||
log.info(`${file}`);
|
||||
});
|
||||
var configs = {};
|
||||
configsList.forEach((file) => {
|
||||
configs[file] = JSON.parse(fs.readFileSync(`configs/nap/${file}`));
|
||||
});
|
||||
return configs;
|
||||
};
|
||||
|
||||
exports.checkConfigs = function (configs) {
|
||||
for (file in configs) {
|
||||
var configThis = configs[file];
|
||||
@ -116,27 +172,53 @@ exports.checkConfigs = function (configs) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.makeHeader = function (data, appversion) {
|
||||
// Updated on 2025/06/29 Windows client 5.7.0
|
||||
exports.hk4e_makeHeader = function (data, appversion) {
|
||||
return {
|
||||
"x-rpc-combo_token": data.token,
|
||||
"x-rpc-client_type": data.client_type,
|
||||
Accept: "*/*",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
Host: "api-cloudgame.mihoyo.com",
|
||||
"x-rpc-app_id": 1953439974,
|
||||
"x-rpc-app_version": appversion,
|
||||
"x-rpc-sys_version": data.sys_version,
|
||||
"x-rpc-cg_game_biz": "hk4e_cn",
|
||||
"x-rpc-cg_game_id": 9000055,
|
||||
"x-rpc-channel": data.channel,
|
||||
"x-rpc-client_type": data.client_type,
|
||||
"x-rpc-combo_token": data.token,
|
||||
"x-rpc-cps": "cypcweb",
|
||||
"x-rpc-device_id": data.device_id,
|
||||
"x-rpc-device_model": data.device_model,
|
||||
"x-rpc-device_name": data.device_name,
|
||||
"x-rpc-language": "zh-cn",
|
||||
"x-rpc-op_biz": "clgm_cn",
|
||||
"x-rpc-preview": 0,
|
||||
"x-rpc-sys_version": data.sys_version,
|
||||
"x-rpc-vendor_id": 1
|
||||
};
|
||||
};
|
||||
|
||||
// Updated on 2025/06/29 Windows client 2.0.1
|
||||
exports.nap_makeHeader = function (data, appversion) {
|
||||
return {
|
||||
Accept: "*/*",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
Host: "cg-nap-api.mihoyo.com",
|
||||
"x-rpc-app_id": 1953461632,
|
||||
"x-rpc-app_version": appversion,
|
||||
"x-rpc-cg_game_biz": "nap_cn",
|
||||
"x-rpc-cg_game_id": 9000357,
|
||||
"x-rpc-channel": data.channel,
|
||||
"x-rpc-client_type": data.client_type,
|
||||
"x-rpc-combo_token": data.token,
|
||||
"x-rpc-cps": "mihoyo",
|
||||
"x-rpc-device_id": data.device_id,
|
||||
"x-rpc-device_name": data.device_name,
|
||||
"x-rpc-device_model": data.device_model,
|
||||
"x-rpc-app_id": 1953439974,
|
||||
"x-rpc-cg_game_biz": "hk4e_cn",
|
||||
"x-rpc-preview": 0,
|
||||
"x-rpc-op_biz": "clgm_cn",
|
||||
"x-rpc-language": "zh-cn",
|
||||
"x-rpc-op_biz": "clgm_nap-cn",
|
||||
"x-rpc-preview": 0,
|
||||
"x-rpc-sys_version": data.sys_version,
|
||||
"x-rpc-vendor_id": 2,
|
||||
Referer: "https://app.mihoyo.com",
|
||||
Host: "api-cloudgame.mihoyo.com",
|
||||
Connection: "Keep-Alive",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
Accept: "*/*",
|
||||
};
|
||||
};
|
||||
|
||||
@ -150,7 +232,7 @@ exports.SendLog = function (
|
||||
) {
|
||||
transporter.sendMail(
|
||||
{
|
||||
from: `"Genshin Cloud Game Helper" <${mailfrom}>`, //邮件来源
|
||||
from: `"Hoyo Cloud Game Helper" <${mailfrom}>`, //邮件来源
|
||||
to: mailto, //邮件发送到哪里,多个邮箱使用逗号隔开
|
||||
subject: `今日已签到${successNum}/${totalNum}名用户`, // 邮件主题
|
||||
text: "", // 存文本类型的邮件正文
|
||||
@ -165,19 +247,19 @@ exports.SendLog = function (
|
||||
);
|
||||
};
|
||||
|
||||
exports.SendResult = function (transporter, mailfrom, mailto, content) {
|
||||
exports.SendResult = function (transporter, mailfrom, mailto, content, key) {
|
||||
transporter.sendMail(
|
||||
{
|
||||
from: `"Genshin Cloud Game Helper" <${mailfrom}>`, //邮件来源
|
||||
from: `"Hoyo Cloud Game Helper" <${mailfrom}>`, //邮件来源
|
||||
to: mailto, //邮件发送到哪里,多个邮箱使用逗号隔开
|
||||
subject: `Genshin Cloud Game Helper`, // 邮件主题
|
||||
subject: `Hoyo Cloud Game Helper`, // 邮件主题
|
||||
text: `${content}`, // 存文本类型的邮件正文
|
||||
},
|
||||
(error) => {
|
||||
if (error) {
|
||||
return console.log(error);
|
||||
}
|
||||
log.info(`已发送通知至${mailto}`);
|
||||
log.info(`${key} - 已发送通知至${mailto}`);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
244
src/index.js
244
src/index.js
@ -1,12 +1,18 @@
|
||||
const {
|
||||
getConfigs,
|
||||
checkConfigs,
|
||||
makeHeader,
|
||||
ListNotification,
|
||||
AckNotification,
|
||||
Wallet,
|
||||
hk4e_getConfigs,
|
||||
hk4e_makeHeader,
|
||||
hk4e_ListNotification,
|
||||
hk4e_AckNotification,
|
||||
hk4e_Wallet,
|
||||
hk4e_AppVersion,
|
||||
nap_getConfigs,
|
||||
nap_makeHeader,
|
||||
nap_ListNotification,
|
||||
nap_AckNotification,
|
||||
nap_Wallet,
|
||||
nap_AppVersion,
|
||||
SendLog,
|
||||
AppVersion,
|
||||
getGlobalConfig,
|
||||
SendResult,
|
||||
} = require("./config");
|
||||
@ -19,99 +25,167 @@ const nodemailer = require("nodemailer");
|
||||
log.info("开始获取全局配置");
|
||||
var globalConfig = getGlobalConfig();
|
||||
log.info("获取成功");
|
||||
if (globalConfig.sendMail == true) {
|
||||
log.info("组装邮件发射器");
|
||||
var transporter = nodemailer.createTransport({
|
||||
host: globalConfig.mailConfig.smtpServer,
|
||||
port: globalConfig.mailConfig.smtpPort,
|
||||
secure: globalConfig.mailConfig.smtpSecure,
|
||||
auth: {
|
||||
user: globalConfig.mailConfig.user,
|
||||
pass: globalConfig.mailConfig.pass,
|
||||
},
|
||||
});
|
||||
}
|
||||
log.info("组装邮件发射器");
|
||||
var transporter = nodemailer.createTransport({
|
||||
host: globalConfig.mailConfig.smtpServer,
|
||||
port: globalConfig.mailConfig.smtpPort,
|
||||
secure: globalConfig.mailConfig.smtpSecure,
|
||||
auth: {
|
||||
user: globalConfig.mailConfig.user,
|
||||
pass: globalConfig.mailConfig.pass,
|
||||
},
|
||||
});
|
||||
var minDelay = globalConfig.minDelay;
|
||||
var maxDelay = globalConfig.maxDelay;
|
||||
var configs = getConfigs();
|
||||
log.info(`正在检测配置有效性`);
|
||||
checkConfigs(configs);
|
||||
var hk4e_configs = hk4e_getConfigs();
|
||||
var nap_configs = nap_getConfigs();
|
||||
log.info(`正在检测原神配置有效性`);
|
||||
checkConfigs(hk4e_configs);
|
||||
log.info("检测完毕!");
|
||||
log.info(`正在检测绝区零配置有效性`);
|
||||
checkConfigs(nap_configs);
|
||||
log.info("检测完毕!");
|
||||
log.info("正在获取版本号");
|
||||
var appversion = await AppVersion();
|
||||
appversion = appversion.data.package_version;
|
||||
log.info(`获取成功!当前版本号:${appversion}`);
|
||||
var successNum = 0,
|
||||
totalNum = 0;
|
||||
for (key in configs) {
|
||||
totalNum++;
|
||||
log.info(`正在执行配置 ${key}`);
|
||||
log.info("尝试签到……");
|
||||
var header = makeHeader(configs[key], appversion);
|
||||
var WalletRespond = await Wallet(header);
|
||||
addLogContent(
|
||||
`<span style="color: orange; font-weight: bold">${key} Wallet返回体</span> <br> <span style="color: orange">${JSON.stringify(
|
||||
WalletRespond
|
||||
)}</span><br>`
|
||||
);
|
||||
if (WalletRespond.data != null) {
|
||||
var NotificationRespond = await ListNotification(header);
|
||||
addLogContent(
|
||||
`<span style="color: orange; font-weight: bold">${key} Notification返回体</span> <br> <span style="color: orange">${JSON.stringify(
|
||||
NotificationRespond
|
||||
)}</span><br>`
|
||||
);
|
||||
successNum++;
|
||||
log.info(
|
||||
`签到完毕! 获得时长:${WalletRespond.data.free_time.send_freetime}分钟,总时长:${WalletRespond.data.free_time.free_time}分钟`
|
||||
);
|
||||
if (configs[key].email != null) {
|
||||
SendResult(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
configs[key].email,
|
||||
`签到完毕! 获得时长:${WalletRespond.data.free_time.send_freetime}分钟,总时长:${WalletRespond.data.free_time.free_time}分钟`
|
||||
);
|
||||
}
|
||||
let NotificationLength = NotificationRespond.data.list.length;
|
||||
let postHeader = header;
|
||||
Object.assign(postHeader, {
|
||||
"Content-Length": 28,
|
||||
"Content-Type": "application/json",
|
||||
});
|
||||
for (var i = 0; i < NotificationLength; i++) {
|
||||
AckNotification(
|
||||
postHeader,
|
||||
NotificationRespond.data.list[i].id
|
||||
);
|
||||
}
|
||||
} else {
|
||||
log.error("签到失败");
|
||||
if (configs[key].email != null) {
|
||||
SendResult(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
configs[key].email,
|
||||
"签到失败"
|
||||
);
|
||||
}
|
||||
}
|
||||
var hk4e_appversion = await hk4e_AppVersion();
|
||||
var nap_appversion = await nap_AppVersion();
|
||||
hk4e_appversion = hk4e_appversion.data.package_version;
|
||||
nap_appversion = nap_appversion.data.package_version;
|
||||
log.info(`获取成功!当前版本号:原神${hk4e_appversion},绝区零${nap_appversion}`);
|
||||
var successNum = 0, totalNum = 0;
|
||||
for (key in hk4e_configs) {
|
||||
var delay = Math.round(
|
||||
Math.random() * (maxDelay - minDelay) + minDelay
|
||||
);
|
||||
log.info(`暂停:${delay}毫秒`);
|
||||
await sleep(delay);
|
||||
totalNum++;
|
||||
log.info(`${key} - 正在执行配置 ${key}`);
|
||||
log.info(`${key} - 尝试签到原神……`);
|
||||
var hk4e_header = hk4e_makeHeader(hk4e_configs[key], hk4e_appversion);
|
||||
var hk4e_WalletRespond = await hk4e_Wallet(hk4e_header);
|
||||
addLogContent(
|
||||
`<span style="color: orange; font-weight: bold">${key} hk4e_Wallet返回体</span> <br> <span style="color: orange">${JSON.stringify(
|
||||
hk4e_WalletRespond
|
||||
)}</span><br>`
|
||||
);
|
||||
if (hk4e_WalletRespond.data != null) {
|
||||
var hk4e_NotificationRespond = await hk4e_ListNotification(hk4e_header);
|
||||
addLogContent(
|
||||
`<span style="color: orange; font-weight: bold">${key} hk4e_Notification返回体</span> <br> <span style="color: orange">${JSON.stringify(
|
||||
hk4e_NotificationRespond
|
||||
)}</span><br>`
|
||||
);
|
||||
successNum++;
|
||||
log.info(
|
||||
`${key} - 签到完毕! 原神总时长:${hk4e_WalletRespond.data.free_time.free_time}分钟`
|
||||
);
|
||||
if (hk4e_configs[key].email != null && globalConfig.sendMail == true) {
|
||||
SendResult(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
hk4e_configs[key].email,
|
||||
`签到完毕! 总时长:${hk4e_WalletRespond.data.free_time.free_time}分钟`,
|
||||
key
|
||||
);
|
||||
}
|
||||
let hk4e_NotificationLength = hk4e_NotificationRespond.data.list.length;
|
||||
let hk4e_postHeader = hk4e_header;
|
||||
Object.assign(hk4e_postHeader, {
|
||||
"Content-Length": 28,
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
});
|
||||
for (var i = 0; i < hk4e_NotificationLength; i++) {
|
||||
hk4e_AckNotification(
|
||||
hk4e_postHeader,
|
||||
hk4e_NotificationRespond.data.list[i].id
|
||||
);
|
||||
}
|
||||
} else {
|
||||
log.error(`${key} - 签到失败`);
|
||||
if (hk4e_configs[key].email != null && globalConfig.sendMail == true) {
|
||||
SendResult(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
hk4e_configs[key].email,
|
||||
"签到失败",
|
||||
key
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (key in nap_configs) {
|
||||
var delay = Math.round(
|
||||
Math.random() * (maxDelay - minDelay) + minDelay
|
||||
);
|
||||
log.info(`暂停:${delay}毫秒`);
|
||||
await sleep(delay);
|
||||
totalNum++;
|
||||
log.info(`${key} - 正在执行配置 ${key}`);
|
||||
log.info(`${key} - 尝试签到绝区零……`);
|
||||
var nap_header = nap_makeHeader(nap_configs[key], nap_appversion);
|
||||
var nap_WalletRespond = await nap_Wallet(nap_header);
|
||||
addLogContent(
|
||||
`<span style="color: orange; font-weight: bold">${key} nap_Wallet返回体</span> <br> <span style="color: orange">${JSON.stringify(
|
||||
nap_WalletRespond
|
||||
)}</span><br>`
|
||||
);
|
||||
if (nap_WalletRespond.data != null) {
|
||||
var nap_NotificationRespond = await nap_ListNotification(nap_header);
|
||||
addLogContent(
|
||||
`<span style="color: orange; font-weight: bold">${key} nap_Notification返回体</span> <br> <span style="color: orange">${JSON.stringify(
|
||||
nap_NotificationRespond
|
||||
)}</span><br>`
|
||||
);
|
||||
successNum++;
|
||||
log.info(
|
||||
`${key} - 签到完毕! 绝区零总时长:${nap_WalletRespond.data.free_time.free_time}分钟`
|
||||
);
|
||||
if (nap_configs[key].email != null && globalConfig.sendMail == true) {
|
||||
SendRnapt(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
nap_configs[key].email,
|
||||
`签到完毕! 总时长:${nap_WalletRespond.data.free_time.free_time}分钟`,
|
||||
key
|
||||
);
|
||||
}
|
||||
let nap_NotificationLength = nap_NotificationRespond.data.list.length;
|
||||
let nap_postHeader = nap_header;
|
||||
Object.assign(nap_postHeader, {
|
||||
"Content-Length": 28,
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
});
|
||||
for (var i = 0; i < nap_NotificationLength; i++) {
|
||||
nap_AckNotification(
|
||||
nap_postHeader,
|
||||
nap_NotificationRespond.data.list[i].id
|
||||
);
|
||||
}
|
||||
} else {
|
||||
log.error(`${key} - 签到失败`);
|
||||
if (nap_configs[key].email != null && globalConfig.sendMail == true) {
|
||||
SendResult(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
nap_configs[key].email,
|
||||
"签到失败",
|
||||
key
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (globalConfig.sendMail == true) {
|
||||
log.info(`暂停:10秒`);
|
||||
await sleep(10000);
|
||||
log.info(`运行完毕!丢出日志`);
|
||||
SendLog(
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
globalConfig.mailConfig.mailto,
|
||||
successNum,
|
||||
totalNum,
|
||||
getLogs()
|
||||
transporter,
|
||||
globalConfig.mailConfig.user,
|
||||
globalConfig.mailConfig.mailto,
|
||||
successNum,
|
||||
totalNum,
|
||||
getLogs()
|
||||
);
|
||||
}
|
||||
})();
|
||||
|
@ -1,5 +1,5 @@
|
||||
const reggol = require("reggol");
|
||||
const baseLogger = new reggol("GenshinCloudGameHelper");
|
||||
const baseLogger = new reggol("HoyoCloudGameHelper");
|
||||
let logContent = ``;
|
||||
exports.addLogContent = function (content) {
|
||||
logContent += content;
|
||||
|
Reference in New Issue
Block a user