fix: stupid mistake

This commit is contained in:
HuanLinOTO 2023-08-27 22:15:01 +08:00
parent 0807aa1052
commit 16c53ef012
3 changed files with 13 additions and 11 deletions

@ -11,28 +11,28 @@ exports.AnnouncementURL = 'https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api
exports.AppVersionURL = 'https://api-takumi.mihoyo.com/ptolemaios/api/getLatestRelease?app_id=1953443910&app_version=3.3.0&channel=mihoyo' exports.AppVersionURL = 'https://api-takumi.mihoyo.com/ptolemaios/api/getLatestRelease?app_id=1953443910&app_version=3.3.0&channel=mihoyo'
exports.Notification = async function(header) { exports.Notification = async function(header) {
let tmp = (await axios("GET",exports.NotificationURL,{ let tmp = (await axios(exports.NotificationURL,{
headers:header headers:header
})).data; })).data;
tmp.StringVersion = JSON.stringify(tmp); tmp.StringVersion = JSON.stringify(tmp);
return tmp; return tmp;
} }
exports.Wallet = async function(header) { exports.Wallet = async function(header) {
let tmp = (await axios("GET",exports.WalletURL,{ let tmp = (await axios(exports.WalletURL,{
headers:header headers:header
})).data; })).data;
tmp.StringVersion = JSON.stringify(tmp); tmp.StringVersion = JSON.stringify(tmp);
return tmp; return tmp;
} }
exports.Announcement = async function(header) { exports.Announcement = async function(header) {
let tmp = (await axios("GET",exports.AnnouncementURL,{ let tmp = (await axios(exports.AnnouncementURL,{
headers:header headers:header
})).data; })).data;
tmp.StringVersion = JSON.stringify(tmp); tmp.StringVersion = JSON.stringify(tmp);
return tmp; return tmp;
} }
exports.AppVersion = async function() { exports.AppVersion = async function() {
let tmp = (await axios("GET",exports.AppVersionURL)).data; let tmp = (await axios(exports.AppVersionURL)).data;
tmp.StringVersion = JSON.stringify(tmp); tmp.StringVersion = JSON.stringify(tmp);
return tmp; return tmp;
} }

@ -5,7 +5,7 @@ const reggol = require("reggol")
const { getConfigs, checkConfigs, makeHeader, Notification, Wallet, SendLog, AppVersion, getGlobalConfig } = require("./config") const { getConfigs, checkConfigs, makeHeader, Notification, Wallet, SendLog, AppVersion, getGlobalConfig } = require("./config")
const urlconfig = require("./config") const urlconfig = require("./config")
const { log } = require("./logger") const { log, addLogContent } = require("./logger");
(async () => { (async () => {
log.info("开始获取全局配置") log.info("开始获取全局配置")
@ -38,9 +38,9 @@ const { log } = require("./logger")
log.info(`正在执行配置 ${key}`) log.info(`正在执行配置 ${key}`)
log.info("尝试签到……") log.info("尝试签到……")
var WalletRespond = await Wallet(makeHeader(configs[key]),appversion); var WalletRespond = await Wallet(makeHeader(configs[key]),appversion);
logContent += `<span style="color: orange">${key} Wallet返回体 <br> ${JSON.stringify(WalletRespond)}</span><br>`; addLogContent(`<span style="color: orange">${key} Wallet返回体 <br> ${JSON.stringify(WalletRespond)}</span><br>`);
var NotificationRespond = await Notification(makeHeader(configs[key])); var NotificationRespond = await Notification(makeHeader(configs[key]));
logContent += `<span style="color: orange">${key} Notification返回体 <br> ${JSON.stringify(NotificationRespond)}</span><br>`; addLogContent(`<span style="color: orange">${key} Notification返回体 <br> ${JSON.stringify(NotificationRespond)}</span><br>`);
if(WalletRespond.data != null) { if(WalletRespond.data != null) {
if(WalletRespond.data.free_time.free_time != undefined) { if(WalletRespond.data.free_time.free_time != undefined) {
successNum ++; successNum ++;

@ -1,13 +1,15 @@
const reggol = require("reggol") const reggol = require("reggol")
const baseLogger = new reggol("GenshinCloudPlayHelper") const baseLogger = new reggol("GenshinCloudPlayHelper")
var logContent = `` let logContent = ``
exports.addLogContent = function(content) {
logContent += content
}
exports.log = { exports.log = {
info(content){ info(content) {
logContent += `<strong style="color: green">[info]</strong> ${content}<br>` logContent += `<strong style="color: green">[info]</strong> ${content}<br>`
baseLogger.info(content) baseLogger.info(content)
}, },
error(content){ error(content) {
logContent += `<strong style="color: red">[error]</strong> ${content}<br>` logContent += `<strong style="color: red">[error]</strong> ${content}<br>`
baseLogger.error(content) baseLogger.error(content)
} }