From de743e9cbfb6392e9495765e4c949c0434279204 Mon Sep 17 00:00:00 2001 From: yan Date: Sun, 18 Jan 2026 22:51:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(auto-tools):=20=E4=BF=AE=E5=A4=8DCD?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重命名cdFiltered为in_cd_paths以提高可读性 - 修正CD路径过滤条件,将返回值取反确保正确过滤 - 修复cron时间类型判断逻辑,添加默认返回false避免意外通过 - 更新变量引用以使用新的变量名in_cd_paths - 修正时间差计算逻辑确保CD状态判断准确 --- repo/js/FullyAutoAndSemiAutoTools/main.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/repo/js/FullyAutoAndSemiAutoTools/main.js b/repo/js/FullyAutoAndSemiAutoTools/main.js index 2b488cf8b..708ae953b 100644 --- a/repo/js/FullyAutoAndSemiAutoTools/main.js +++ b/repo/js/FullyAutoAndSemiAutoTools/main.js @@ -553,24 +553,24 @@ async function initRun(config_run) { recordPaths.sort((a, b) => b.timestamp - a.timestamp) const timeConfigs = Array.from(timeJson); - - const cdFiltered = matchedPaths.filter(item => { + //还在cd中的path + const in_cd_paths = matchedPaths.filter(item => { const timeConfig = timeConfigs.find(cfg => item.fullPathNames.includes(cfg.name) ); - if (!timeConfig) return true; + if (!timeConfig) return false; const record = recordPaths.find(r => r.path.includes(item.path) ); - if (!record || !record.timestamp) return true; + if (!record || !record.timestamp) return false; const now = Date.now(); switch (timeType.fromValue(timeConfig.type)) { case timeType.hours: { const diff = getTimeDifference(record.timestamp, now); - return diff.total.hours >= timeConfig.value; + return !(diff.total.hours >= timeConfig.value); } case timeType.cron: { const next = cronUtil.getNextCronTimestamp( @@ -579,17 +579,17 @@ async function initRun(config_run) { now, cd.http_api ); - return next && now >= next; + return !(next && now >= next); } default: - return true; + return false; } }); // 移除 CD 未到的路径 - if (cdFiltered.length > 0) { + if (in_cd_paths.length > 0) { matchedPaths = Array.from( - new Set(matchedPaths).difference(new Set(cdFiltered)) + new Set(matchedPaths).difference(new Set(in_cd_paths)) ); } }