tools_batch_files 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -555,7 +555,7 @@ const task = async (row, index) => {
555
555
  logger(resData.data.code);
556
556
  logger(resData.data);
557
557
  //删除文件夹
558
- // fs.rmdirSync(indexFilePath, { recursive: true });
558
+ fs.rmdirSync(indexFilePath, { recursive: true });
559
559
  } else {
560
560
  throw new Error("请求失败!" + resData.data.msg);
561
561
  }
@@ -573,7 +573,7 @@ const task = async (row, index) => {
573
573
  }
574
574
  logger("catch日志*********************************");
575
575
  disposeError(fileName);
576
- // fs.rmdirSync(indexFilePath, { recursive: true });
576
+ fs.rmdirSync(indexFilePath, { recursive: true });
577
577
  }
578
578
  };
579
579
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tools_batch_files",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "批处理视频工具",
5
5
  "keywords": [
6
6
  "utils",
package/src/photoBatch.js CHANGED
@@ -19,7 +19,7 @@ const excelDir = path.join(workDir, "excel", "excel.xlsx");
19
19
  //水印
20
20
  const watermarkImage = path.join(__dirname, "..", "imgs", "picWater.png");
21
21
 
22
- //拷贝 - 存放上传失败的文件
22
+ //拷贝 - 存放上传失败的文件
23
23
  const Error_Files_Dir = "failed_photos";
24
24
 
25
25
  // 截图数量
@@ -41,7 +41,13 @@ const expandedName = ".jpg";
41
41
  const queueCount = 50;
42
42
 
43
43
  //起始任务下标
44
- let taskIndex = 123265;
44
+ let taskIndex = 0;
45
+
46
+ //重传的 上传进度
47
+ const progressIndex = 0;
48
+
49
+ //重传的总数
50
+ const totals = 11874;
45
51
 
46
52
  const readExcel = (path) => {
47
53
  const workbook = XLSX.readFile(path);
@@ -463,11 +469,18 @@ const task = async (row, index) => {
463
469
  logger(`-------------------${new Date()}------------------`);
464
470
 
465
471
  if (resData.data.code === 200) {
472
+ progressIndex++;
466
473
  logger("请求成功!");
467
- logger(resData.data.code);
468
474
  logger(resData.data);
475
+ if (totals) {
476
+ logger(`任务进度:${progressIndex}/${totals}`);
477
+ }
469
478
  //删除文件夹
470
479
  fs.rmdirSync(indexFilePath, { recursive: true });
480
+ } else if (resData.data.code === 300) {
481
+ //不捕获此错误
482
+ logger(`第${index}条文件-${index}重复上传!`);
483
+ fs.rmdirSync(indexFilePath, { recursive: true });
471
484
  } else {
472
485
  throw new Error("请求失败!" + resData.data.msg);
473
486
  }