hl 7 meses atrás
pai
commit
87e854a276
2 arquivos alterados com 7 adições e 3 exclusões
  1. 3 1
      src/Interval.js
  2. 4 2
      src/utils/file.js

+ 3 - 1
src/Interval.js

@@ -48,7 +48,9 @@ function reportSearchPositions() {//DOTO node 代码修改完毕,待测试
             logger.info('发起清仓检查:' + value.id + "停机时间:" + value.closeTime + "当前时间:" + new Date().getTime());
 
             let isStartTime = value.closeTime + (1000 * 60)
-            if (value.id !== -1 && isStartTime <= new Date().getTime() && (value.threadStatus === robot.RobotStatus.STOPPED || value.threadStatus === robot.RobotStatus.ERROR)
+            if (value.id !== -1
+                && isStartTime <= new Date().getTime()
+                && (value.threadStatus === robot.RobotStatus.STOPPED || value.threadStatus === robot.RobotStatus.ERROR)
                 // && value.isClearance === false
             ) {
                 logger.info('--发起清仓' + value.id);

+ 4 - 2
src/utils/file.js

@@ -103,8 +103,10 @@ function getLastFile(dirPath, number, callback) {
             for (file of files) {
                 const filePath = path.join(dirPath, file);
                 const stats = await fs.promises.stat(filePath);
-                fileList.push({name: file, time: stats.birthtime.getTime()});
-                // logger.info("文件:" + filePath + "时间:" + stats.birthtime.getTime())
+                if(stats.isFile()){
+                    fileList.push({name: file, time: stats.birthtime.getTime()});
+                    // logger.info("文件:" + filePath + "时间:" + stats.birthtime.getTime())
+                }
             }
 
             fileList.sort((a, b) => b.time - a.time);