Przeglądaj źródła

进行了一些小优化

zhangyang 6 lat temu
rodzic
commit
40f23a95ce

BIN
bin/Win32/Debug/zhipuzi_pay_plugin/zpzDll.dll


BIN
lib/debug/zpzDll.lib


+ 8 - 1
zhipuzi_pay_plugin/helper/CBitmapHelper.cpp

@@ -307,6 +307,7 @@ bool CBitmapHelper::OcrRect(tesseract::TessBaseAPI& tess, LPRECT lpRect, std::st
 		else if (utf8_ret[i] == 32)
 		{
 			//如果是空格,直接忽略
+			continue;
 		}
 		else if (utf8_ret[i] == '\n')
 		{
@@ -315,12 +316,18 @@ bool CBitmapHelper::OcrRect(tesseract::TessBaseAPI& tess, LPRECT lpRect, std::st
 
 			break;
 		}
+		else if (utf8_ret[i] == -62 && utf8_ret[i + 1] == -91)
+		{
+			//这个是人民币符号¥
+			i += 1;
+			continue;
+		}
 		else
 		{
 			//既不是有效数字,也不是空格和换行,那么就是出现了非法字符
 			result = "0.00";
 
-			break;
+			//break;
 		}
 	}
 

+ 34 - 3
zhipuzi_pay_plugin/wnd/CValueWnd.cpp

@@ -699,6 +699,7 @@ void CValueWnd::UpdateKexian(const char* data, int length)
 
 
     std::string show_command = "\x1bQA";
+	std::string show_command_2 = "QA";
     std::string type_command = "\x1bs";
 
     if(new_data == clear_command || new_data == quanmie_command)
@@ -707,14 +708,37 @@ void CValueWnd::UpdateKexian(const char* data, int length)
         return;
     }
 
+	int nShowType;
     if(new_data.find(show_command) == new_data.npos)
     {
-        return;
+		//没有\x1bQA,继续找有没有QA(比如思迅)
+		if (new_data.find(show_command_2) == new_data.npos)
+		{
+			//完全没QA
+			return;
+		}
+		else
+		{
+			nShowType = 2;
+		}
     }
+	else
+	{
+		nShowType = 1;
+	}
 
     std::string money;
 
-    int nPos = new_data.find(show_command);
+	int nPos;
+	
+	if (nShowType == 1)
+	{
+		nPos = new_data.find(show_command);;
+	}
+	else
+	{
+		nPos = new_data.find(show_command_2);
+	}	
 
     int nTypePos = new_data.find(type_command, nPos + 1);
 
@@ -729,7 +753,14 @@ void CValueWnd::UpdateKexian(const char* data, int length)
             return;
         }
 
-        money = new_data.substr(nPos + 3, nTabPos - nPos - 3);
+		if (nShowType == 1)
+		{
+			money = new_data.substr(nPos + 3, nTabPos - nPos - 3);
+		}
+		else
+		{
+			money = new_data.substr(nPos + 2, nTabPos - nPos - 2);
+		}
 
         CLabelUI* valueLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("value")));