From eea36a2fa192db8ff880680ffad746aab5a1db1f Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Thu, 12 Jan 2023 09:11:36 +0800 Subject: [PATCH 1/2] update appversion url --- .gitignore | 3 +++ index.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c4b9b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +configs/ +node_modules/ +pnpm-lock.yaml \ No newline at end of file diff --git a/index.js b/index.js index 8ea0745..3323c95 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,7 @@ log.info("检测完毕!") log.info("正在获取版本号") var appversion = AppVersion(); -appversion = appversion.data.config["cg.key_function_controller"].versions[appversion.data.config["cg.key_function_controller"].versions.length-1] +appversion = appversion.data.config["cg.key_function_video_mode"].versions["0"] log.info(`获取成功!当前版本号:${appversion}`) var successNum = 0,totalNum = 0; for(key in configs) { From 47fe03e978e5c2075e0fa8742161ba51e4a8b8c1 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Thu, 12 Jan 2023 09:31:35 +0800 Subject: [PATCH 2/2] some changes - check all configs - log when response data is null instead of crashing --- config.js | 9 ++++----- index.js | 16 ++++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/config.js b/config.js index c01a6f5..8b0b63b 100644 --- a/config.js +++ b/config.js @@ -87,14 +87,13 @@ exports.checkConfigs = function(configs){ if(configThis[configKeys[key]] == "" || configThis[configKeys[key]] == undefined || configThis[configKeys[key]] == null || configThis[configKeys[key]] == NaN) { log.error(`配置文件 ${file} 异常:`); log.error(` —— ${configKeys[key]}字段缺失`); - isNoProbem = false; - break; + // isNoProbem = false; } } - if(!isNoProbem) { - exit(); - } + // if(!isNoProbem) { + // exit(); + // } } } diff --git a/index.js b/index.js index 3323c95..0a3e015 100644 --- a/index.js +++ b/index.js @@ -59,12 +59,16 @@ for(key in configs) { logContent += `${key} Wallet返回体
${JSON.stringify(WalletRespond)}

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

`; - if(WalletRespond.data.free_time.free_time != undefined) { - successNum ++; - log.info(`签到完毕! 剩余时长:${WalletRespond.data.free_time.free_time}分钟`) - let NotificationLength = NotificationRespond.data.list.length - if(NotificationLength != 0) { - log.info(`已堆积 ${NotificationLength} 个签到通知 请及时处理!`) + if(WalletRespond.data != null) { + if(WalletRespond.data.free_time.free_time != undefined) { + successNum ++; + log.info(`签到完毕! 剩余时长:${WalletRespond.data.free_time.free_time}分钟`) + let NotificationLength = NotificationRespond.data.list.length + if(NotificationLength != 0) { + log.info(`已堆积 ${NotificationLength} 个签到通知 请及时处理!`) + } + } else { + log.error("签到失败") } } else { log.error("签到失败")