Pārlūkot izejas kodu

Z991239-6212 #comment 高拍仪图片清理兜底

80374374 4 mēneši atpakaļ
vecāks
revīzija
d952d352cc

+ 3 - 15
Module/mod_HSPScanner/HSPScannerFSM.cpp

@@ -1690,6 +1690,7 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
 		ctx->Answer(TransECWithRepeat(erroCode), GetLastUserCode());
 		nRes = 2;
 	}
+	ClearPictureFileSure(1);
 	return nRes;
 }
 
@@ -1783,6 +1784,7 @@ int CHSPScannerFSM::ScanImageEx(SpReqAnsContext<HSPScannerService_ScanImageEx_Re
 		delete pBtImage;
 		pBtImage = NULL;
 	}
+	ClearPictureFileSure(2);
 	return nRes;
 }
 
@@ -2021,22 +2023,7 @@ BOOL CHSPScannerFSM::DelAndGetNewFileName(CSimpleStringA& csfileName, bool bInBu
 	strAimPath = strPath + SPLIT_SLASH_STR + fileName;
 
 	UpdateAndWarnFileFindInDepBak(strAimPath, fileName, HSPScanner_UserErrorCode_FindFile_in_DepBak);
-#if 0
-	///*TODO(80374374@10/11/2022): 这段代码上线一段时间后要去除,因为从这个版本开始这个文件就不生成在这个目录了 */
-	if (ExistsFileA(strAimPath)) {
-		if (DeleteFileA((LPCTSTR)strAimPath) != 0) {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DeleteFile(%s) suc.", (LPCTSTR)strAimPath);
-		} else {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DeleteFile(%s) failed LastError(%d).", (LPCTSTR)strAimPath, GetLastError());
-		}
-	}
-	strPath.Clear();
-	GetEntityBase()->GetFunction()->GetPath("Temp", strPath);
-	strAimPath = strPath + SPLIT_SLASH_STR + fileName;
-#endif
-	// Add [Josephus in 17:04:27 2016/10/25]
 	csfileName = strAimPath;
-
 	if (ExistsFileA(csfileName)) {
 		if (RemoveFileA((LPCTSTR)strAimPath) != 0) {
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("DeleteFile(%s) suc.", (LPCTSTR)strAimPath);
@@ -2250,6 +2237,7 @@ int CHSPScannerFSM::ScanImageJS(SpReqAnsContext<HSPScannerService_ScanImageJS_Re
 		ret = 1;
 	}
 	ctx->Answer(erroCode, GetLastUserCode());
+	ClearPictureFileSure(1);
 	return ret;
 }
 

+ 11 - 6
Module/mod_HSPScanner/HSPScannerFSM.h

@@ -366,13 +366,18 @@ private:
 	
 	void InitialMaxResizeValue();
 
-	void ClearPictureFileSure()
+	void ClearPictureFileSure(int nMask = 3)
 	{
-		CSimpleStringA strNoUsed(true);
-		GetCurImageName(strNoUsed);
-		DelAndGetNewFileName(strNoUsed);
-		GetCurImageName(strNoUsed, true);
-		DelAndGetNewFileName(strNoUsed);
+		if (!!(nMask & 1)) {
+			CSimpleStringA strNoUsed(true);
+			GetCurImageName(strNoUsed);
+			DelAndGetNewFileName(strNoUsed);
+		}
+		if (!!(nMask & 2)) {
+			CSimpleStringA strNoUsed(true);
+			GetCurImageName(strNoUsed, true);
+			DelAndGetNewFileName(strNoUsed);
+		}
 	}
 };