From eca2ab1c3ca658bf1977c9bf0d1097a47d1d511c Mon Sep 17 00:00:00 2001 From: JJMdzh Date: Mon, 26 May 2025 18:44:10 +0800 Subject: [PATCH] =?UTF-8?q?js=EF=BC=8C=E8=83=8C=E5=8C=85=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E8=80=97=E6=97=B6=20(#928)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/js/背包材料统计/main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/repo/js/背包材料统计/main.js b/repo/js/背包材料统计/main.js index f29414a3..6946d123 100644 --- a/repo/js/背包材料统计/main.js +++ b/repo/js/背包材料统计/main.js @@ -925,7 +925,7 @@ function calculatePerTime(resourceName, pathName, recordDir) { const quantityChangeLine = lines[i + 4]; // 假设数量变化在路径名后的第五行 if (runTimeLine.startsWith('运行时间: ') && quantityChangeLine.startsWith('数量变化: ')) { - const runTime = parseFloat(runTimeLine.split('运行时间: ')[1].split('秒')[0]); + const runTime = parseInt(runTimeLine.split('运行时间: ')[1].split('秒')[0], 10); const quantityChange = JSON.parse(quantityChangeLine.split('数量变化: ')[1]); // 检查数量变化是否有效 @@ -1226,7 +1226,13 @@ normalPaths.sort((a, b) => { // 调用路径文件 await pathingScript.runFile(pathingFilePath); - await sleep(1000); + await sleep(100); + + // 记录结束时间 + const endTime = new Date().toLocaleString(); + + // 计算运行时间 + const runTime = (new Date(endTime) - new Date(startTime)) / 1000; // 秒 // 根据 materialCategoryMap 构建 resourceCategoryMap const resourceCategoryMap = {}; @@ -1270,12 +1276,6 @@ normalPaths.sort((a, b) => { // 打印数量差值 log.info(`数量变化: ${JSON.stringify(materialCountDifferences, null, 2)}`); - // 记录结束时间 - const endTime = new Date().toLocaleString(); - - // 计算运行时间 - const runTime = (new Date(endTime) - new Date(startTime)) / 1000; // 秒 - // 记录运行时间到材料对应的文件中 recordRunTime(resourceName, pathName, startTime, endTime, runTime, recordDir, materialCountDifferences); log.info(`当前材料名: ${JSON.stringify(resourceName, null, 2)}`);