From 16c53ef01236fa1831dcfba3edbd5242e0a7d51f Mon Sep 17 00:00:00 2001 From: HuanLinOTO Date: Sun, 27 Aug 2023 22:15:01 +0800 Subject: [PATCH] fix: stupid mistake --- src/config.js | 8 ++++---- src/index.js | 6 +++--- src/logger.js | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/config.js b/src/config.js index ff578c8..6512caf 100644 --- a/src/config.js +++ b/src/config.js @@ -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.Notification = async function(header) { - let tmp = (await axios("GET",exports.NotificationURL,{ + let tmp = (await axios(exports.NotificationURL,{ headers:header })).data; tmp.StringVersion = JSON.stringify(tmp); return tmp; } exports.Wallet = async function(header) { - let tmp = (await axios("GET",exports.WalletURL,{ + let tmp = (await axios(exports.WalletURL,{ headers:header })).data; tmp.StringVersion = JSON.stringify(tmp); return tmp; } exports.Announcement = async function(header) { - let tmp = (await axios("GET",exports.AnnouncementURL,{ + let tmp = (await axios(exports.AnnouncementURL,{ headers:header })).data; tmp.StringVersion = JSON.stringify(tmp); return tmp; } exports.AppVersion = async function() { - let tmp = (await axios("GET",exports.AppVersionURL)).data; + let tmp = (await axios(exports.AppVersionURL)).data; tmp.StringVersion = JSON.stringify(tmp); return tmp; } diff --git a/src/index.js b/src/index.js index 4e9d427..466d7c0 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ const reggol = require("reggol") const { getConfigs, checkConfigs, makeHeader, Notification, Wallet, SendLog, AppVersion, getGlobalConfig } = require("./config") const urlconfig = require("./config") -const { log } = require("./logger") +const { log, addLogContent } = require("./logger"); (async () => { log.info("开始获取全局配置") @@ -38,9 +38,9 @@ const { log } = require("./logger") log.info(`正在执行配置 ${key}`) log.info("尝试签到……") var WalletRespond = await Wallet(makeHeader(configs[key]),appversion); - logContent += `${key} Wallet返回体
${JSON.stringify(WalletRespond)}

`; + addLogContent(`${key} Wallet返回体
${JSON.stringify(WalletRespond)}

`); var NotificationRespond = await Notification(makeHeader(configs[key])); - logContent += `${key} Notification返回体
${JSON.stringify(NotificationRespond)}

`; + addLogContent(`${key} Notification返回体
${JSON.stringify(NotificationRespond)}

`); if(WalletRespond.data != null) { if(WalletRespond.data.free_time.free_time != undefined) { successNum ++; diff --git a/src/logger.js b/src/logger.js index 079fd08..507158c 100644 --- a/src/logger.js +++ b/src/logger.js @@ -1,13 +1,15 @@ const reggol = require("reggol") const baseLogger = new reggol("GenshinCloudPlayHelper") -var logContent = `` - +let logContent = `` +exports.addLogContent = function(content) { + logContent += content +} exports.log = { - info(content){ + info(content) { logContent += `[info] ${content}
` baseLogger.info(content) }, - error(content){ + error(content) { logContent += `[error] ${content}
` baseLogger.error(content) }