Преглед изворни кода

Z991239-5022 #comment feat: 去除合成头像功能

陈纪林80310970 пре 1 година
родитељ
комит
b9c669bd6c
2 измењених фајлова са 65 додато и 56 уклоњено
  1. 64 55
      Module/mod_IDCertificate/IDCertFSM.cpp
  2. 1 1
      Module/mod_IDCertificate/IDCertFSM.h

+ 64 - 55
Module/mod_IDCertificate/IDCertFSM.cpp

@@ -2,7 +2,7 @@
 #include "IDCertFSM.h"
 #include "GetDevInfoHelper.h"
 #include "EventCode.h"
-#include "libimageproc.h"
+//#include "libimageproc.h"
 #include "ModuleMix.h"
 #include "IDCertificate_UserErrorCode.h"
 #include <highgui.h>
@@ -876,13 +876,16 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
 					LogWarn(Severity_Low, Error_Succeed, IDCertificate_UserErrorCode_ReadAndScan_GetIDInfo, csIDLogInfo.GetData());
 
 					GetPngBlobEx(ctx->Ans.headphoto, "zp", true);
+					ctx->Ans.photodata = ctx->Ans.headphoto;
+					DeleteZP(Bmp_ZP);
+					/*DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to get photo");
 					eErr = GetPngBlob(ctx->Ans.photodata, true);
 					if (eErr != Error_Succeed)
 					{
 						bGetIDCert = false;
-						LOG_TRACE("get photo failed.");
+						DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get photo failed.");
 						break;
-					}
+					}*/
 					bGetIDCert = true;
 					break;
 				}
@@ -997,13 +1000,16 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
 
 					LogWarn(Severity_Low, Error_Succeed, IDCertificate_UserErrorCode_ReadAndScan_GetIDInfo, csIDLogInfo.GetData());
 
+					ctx->Ans.photodata = ctx->Ans.headphoto;
+					DeleteZP(Bmp_ZP);
+					/*DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to get photo");
 					eErr = GetPngBlob(ctx->Ans.photodata, true);
 					if (eErr != Error_Succeed)
 					{
 						bGetIDCert = false;
 						DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get photo failed.");
 						break;
-					}
+					}*/
 					bGetIDCert = true;
 					break;
 				}
@@ -1609,13 +1615,16 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
 					LogWarn(Severity_Low, Error_Succeed, IDCertificate_UserErrorCode_ReadAndScan_GetIDInfo, csIDLogInfo.GetData());
 
 					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to get photo");
+					ctx->Ans.photodata = ctx->Ans.headphoto;
+					DeleteZP(Bmp_ZP);
+					/*DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to get photo");
 					eErr = GetPngBlob(ctx->Ans.photodata, true);
 					if (eErr != Error_Succeed)
 					{
 						bGetIDCert = false;
 						DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get photo failed.");
 						break;
-					}
+					}*/
 					bGetIDCert = true;
 					break;
 				}
@@ -1819,56 +1828,56 @@ int CIDCertFSM::ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCe
 	return 0;
 }
 
-ErrorCodeEnum CIDCertFSM::GetPngBlob(CBlob &data, bool bClear)
-{
-	CSimpleStringA strPath,strBkPath,strBmpPath,strPngPath,strTxtPath,strWltPath;
-	ErrorCodeEnum err;
-	err = m_pEntity->GetFunction()->GetPath("Dep", strPath);
-	if (err != Error_Succeed)
-	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get path failed.");
-		return Error_Param;
-	}
-
-#ifdef RVC_OS_WIN
-	strBkPath = strPath + "\\" + bkPicPath;
-	strBmpPath = strPath + "\\zp.bmp";
-	strPngPath = strPath + "\\zp.JPEG";
-	strTxtPath = strPath + "\\wz.txt";
-	strWltPath = strPath + "\\xp.wlt";
-#else
-	strBkPath = strPath + SPLIT_SLASH_STR + bkPicPath;
-	strBmpPath = strPath + SPLIT_SLASH_STR + "zp.bmp";
-	strPngPath = strPath + SPLIT_SLASH_STR + "zp.JPEG";
-	strTxtPath = strPath + SPLIT_SLASH_STR + "wz.txt";
-	strWltPath = strPath + SPLIT_SLASH_STR + "xp.wlt";
-#endif
-
-	bool bResult = imageprocess((char*)strBkPath.GetData(), (char*)strBmpPath.GetData(), (char*)strPngPath.GetData());
-	if (!bResult)
-	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetPngBlob")
-			("photo changed failed.");
-		return Error_Unexpect;
-	}
-
-	FILE *fp = fopen(strPngPath, "rb");
-	if (fp) {
-		fseek(fp, 0, SEEK_END);
-		long flen = ftell(fp);
-		fseek(fp, 0, SEEK_SET);
-		data.Alloc(flen);
-		fread(data.m_pData, 1, flen, fp);
-		fclose(fp);
-	} else {
-		LOG_TRACE("fopen %s failed!", (LPCSTR)strPngPath);
-		err = Error_IO;
-	}
-
-	if (bClear)
-		DeleteZP(Bmp_ZP);
-	return err;
-}
+//ErrorCodeEnum CIDCertFSM::GetPngBlob(CBlob &data, bool bClear)
+//{
+//	CSimpleStringA strPath,strBkPath,strBmpPath,strPngPath,strTxtPath,strWltPath;
+//	ErrorCodeEnum err;
+//	err = m_pEntity->GetFunction()->GetPath("Dep", strPath);
+//	if (err != Error_Succeed)
+//	{
+//		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get path failed.");
+//		return Error_Param;
+//	}
+//
+//#ifdef RVC_OS_WIN
+//	strBkPath = strPath + "\\" + bkPicPath;
+//	strBmpPath = strPath + "\\zp.bmp";
+//	strPngPath = strPath + "\\zp.JPEG";
+//	strTxtPath = strPath + "\\wz.txt";
+//	strWltPath = strPath + "\\xp.wlt";
+//#else
+//	strBkPath = strPath + SPLIT_SLASH_STR + bkPicPath;
+//	strBmpPath = strPath + SPLIT_SLASH_STR + "zp.bmp";
+//	strPngPath = strPath + SPLIT_SLASH_STR + "zp.JPEG";
+//	strTxtPath = strPath + SPLIT_SLASH_STR + "wz.txt";
+//	strWltPath = strPath + SPLIT_SLASH_STR + "xp.wlt";
+//#endif
+//
+//	bool bResult = imageprocess((char*)strBkPath.GetData(), (char*)strBmpPath.GetData(), (char*)strPngPath.GetData());
+//	if (!bResult)
+//	{
+//		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetPngBlob")
+//			("photo changed failed.");
+//		return Error_Unexpect;
+//	}
+//
+//	FILE *fp = fopen(strPngPath, "rb");
+//	if (fp) {
+//		fseek(fp, 0, SEEK_END);
+//		long flen = ftell(fp);
+//		fseek(fp, 0, SEEK_SET);
+//		data.Alloc(flen);
+//		fread(data.m_pData, 1, flen, fp);
+//		fclose(fp);
+//	} else {
+//		LOG_TRACE("fopen %s failed!", (LPCSTR)strPngPath);
+//		err = Error_IO;
+//	}
+//
+//	if (bClear)
+//		DeleteZP(Bmp_ZP);
+//	return err;
+//}
 ErrorCodeEnum CIDCertFSM::GetPngBlobEx(CBlob &data, CSimpleStringA fileNamePrefix, bool bClear)
 {
 	CSimpleStringA strPath, errMsg;

+ 1 - 1
Module/mod_IDCertificate/IDCertFSM.h

@@ -317,7 +317,7 @@ public:
 	static void HttpsLogCallBack(const char* logtxt);
 private:
 	ErrorCodeEnum GetVendorDllPath(CSimpleStringA &strPath);
-	ErrorCodeEnum GetPngBlob(CBlob &data,bool bClear=false);
+	//ErrorCodeEnum GetPngBlob(CBlob &data,bool bClear=false);
 	ErrorCodeEnum GetPngBlobEx(CBlob &data, CSimpleStringA fileNamePrefix,bool bClear=false);
 	//type:1,delete img about zp; type:2,delete img about scan ID;type:3,delete both zp and scan ID
 	void DeleteZP(int type);