Ver Fonte

将日志 与 机器人状态详情进行缓存,

hl há 3 semanas atrás
pai
commit
160138c17a
1 ficheiros alterados com 9 adições e 3 exclusões
  1. 9 3
      src/utils/file.js

+ 9 - 3
src/utils/file.js

@@ -106,15 +106,21 @@ function getLastFile(dirPath, number, callback) {
                 // logger.info("所有文件:",filePath)
                 const stats = await fs.promises.stat(filePath);
                 if (stats.isFile()) {
-                    fileList.push({name: file, time: stats.birthtime.getTime()});
-                    logger.info("----------------所有文件:" + filePath + "时间:" + stats.birthtime.getTime())
+                    let tt = stats.birthtime.getTime()
+                    fileList.push({name: file, time: tt});
+                    logger.info("----------------所有文件:" + filePath + "时间:" + tt)
                 }
             }
+            for (a of fileList) {
+                const filePath = path.join(dirPath, a.name);
+                logger.info("复查:" + filePath + "\ttime:" + a.time)
+            }
+
 
             fileList.sort((a, b) => b.time - a.time);
             for (a of fileList) {
                 const filePath = path.join(dirPath, a.name);
-                logger.info("排序之后的顺序:" + filePath + "\ttime:" + a.time)
+                logger.info("排序:" + filePath + "\ttime:" + a.time)
             }
             let lastFileList = fileList.slice(0, number != -1 ? number : fileList.length);
             let lastFileNameList = lastFileList.map((item) => item.name);