Browse Source

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

hl 3 weeks ago
parent
commit
160138c17a
1 changed files with 9 additions and 3 deletions
  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);