tools_batch_files 1.0.19 → 1.0.20
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/package.json +1 -1
- package/src/photoBatch.js +36 -4
package/package.json
CHANGED
package/src/photoBatch.js
CHANGED
@@ -332,7 +332,7 @@ const postData = (dataParams, indexFilePath) => {
|
|
332
332
|
headers: {
|
333
333
|
"Content-Type": "multipart/form-data",
|
334
334
|
},
|
335
|
-
timeout:
|
335
|
+
timeout: 60000, // 设置超时时间为 60 秒
|
336
336
|
});
|
337
337
|
};
|
338
338
|
|
@@ -356,11 +356,18 @@ const task = async (row, index) => {
|
|
356
356
|
fileName = row.fileName + expandedName;
|
357
357
|
}
|
358
358
|
|
359
|
+
const getPathStartTime = new Date();
|
359
360
|
// 源图片文件夹路径
|
360
361
|
const originFilePath = findFileInDir(
|
361
362
|
path.join(workDir, ORIGIN_FILE_DIR),
|
362
363
|
fileName
|
363
364
|
);
|
365
|
+
const getPathEndTime = new Date();
|
366
|
+
const timeInSeconds = ((getPathEndTime - getPathStartTime) / 1000).toFixed(2);
|
367
|
+
|
368
|
+
logger(`第${index}条Path路径搜索时间:${timeInSeconds}秒`);
|
369
|
+
logger(`-------------------${new Date()}------------------`);
|
370
|
+
|
364
371
|
console.log("originFilePath:" + originFilePath);
|
365
372
|
console.log("fileName:" + fileName);
|
366
373
|
|
@@ -373,6 +380,7 @@ const task = async (row, index) => {
|
|
373
380
|
const indexFilePath = path.join(workDir, "output", index + "");
|
374
381
|
|
375
382
|
try {
|
383
|
+
const workStartTime = new Date();
|
376
384
|
await fs_asnyc.access(originFilePath, fs_asnyc.constants.F_OK);
|
377
385
|
logFileSize(originFilePath);
|
378
386
|
await PriviewPhoto(indexFilePath, originFilePath, fileName);
|
@@ -388,10 +396,21 @@ const task = async (row, index) => {
|
|
388
396
|
keyword,
|
389
397
|
}
|
390
398
|
);
|
391
|
-
|
392
|
-
|
399
|
+
const workEndTime = new Date();
|
400
|
+
const timeInSeconds = ((workEndTime - workStartTime) / 1000).toFixed(2);
|
401
|
+
|
402
|
+
logger(`第${index}条4090处理总时间:${timeInSeconds}秒`);
|
403
|
+
logger(`-------------------${new Date()}------------------`);
|
393
404
|
|
405
|
+
|
406
|
+
const postStartTime = new Date();
|
394
407
|
const resData = await postData(dataParams, indexFilePath);
|
408
|
+
const postEndTime = new Date();
|
409
|
+
const timeInSeconds1 = ((postEndTime - postStartTime) / 1000).toFixed(2);
|
410
|
+
|
411
|
+
logger(`第${index}条接口处理总时间:${timeInSeconds1}秒`);
|
412
|
+
logger(`-------------------${new Date()}------------------`);
|
413
|
+
|
395
414
|
if (resData.data.code === 200) {
|
396
415
|
logger("请求成功!");
|
397
416
|
logger(resData.data.code);
|
@@ -432,12 +451,25 @@ const transitionExcelToJSON = () => {
|
|
432
451
|
const jsonData = readExcel(excelDir);
|
433
452
|
|
434
453
|
const run = (index) => {
|
454
|
+
logger(
|
455
|
+
`run-------------------------------------第${index}条开始------------------------------------`
|
456
|
+
);
|
457
|
+
const readExcelStartTime = new Date();
|
435
458
|
const row = jsonData[index];
|
459
|
+
|
460
|
+
const readExcelEndTime = new Date();
|
461
|
+
const timeInSeconds = (
|
462
|
+
(readExcelEndTime - readExcelStartTime) /
|
463
|
+
1000
|
464
|
+
).toFixed(2);
|
465
|
+
|
466
|
+
logger(`第${index}条Excel搜索时间:${timeInSeconds}秒`);
|
467
|
+
logger(`-------------------${new Date()}------------------`);
|
436
468
|
if (!row) {
|
437
469
|
return;
|
438
470
|
}
|
439
471
|
logger(
|
440
|
-
`----------------------------------------第${index}
|
472
|
+
`----------------------------------------第${index}条task开始--------------------------------`
|
441
473
|
);
|
442
474
|
logger(`-------------------${new Date()}------------------`);
|
443
475
|
task(row, index)
|