张洋 6 лет назад
Родитель
Сommit
f25beb2f15

+ 2 - 0
bin/Win32/Debug/zhipuzi_pay_plugin/skin/dingweiinfo_wnd.xml

@@ -3,5 +3,7 @@
 <Font id="0" name="微软雅黑" size="14" />
 <HorizontalLayout bkcolor="0xFF3C3A3A">
 	<Label name="dingweiinfo_wnd_info" text="" textcolor="#FFFFFFFF" font="0" padding="10,0,0,0"></Label>
+	<Button name="dingweiinfo_wnd_info_confirme" width="60" height="32" padding="10,2,0,0" text="选择" normalimage="file='Btn_Green.png' corner='5,5,5,5'" hotimage="file='Btn_Green_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" />
+	<Button name="dingweiinfo_wnd_info_quit" width="60" height="32" padding="10,2,10,0" text="退出" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
 </HorizontalLayout>
 </Window>

+ 7 - 2
bin/Win32/Debug/zhipuzi_pay_plugin/skin/jinezhuaqu_setting.xml

@@ -80,8 +80,8 @@
 				</HorizontalLayout>
 				
 				<HorizontalLayout name="jinezhuaqu_setting_chuangkou_select_value_search_result_layout" padding="0,10,0.0" height="44" visible="false">
-					<Label text="检索结果" width="180" padding="30,0,0,0"/>
-					<Label name="jinezhuaqu_setting_chuangkou_select_value_search_result" text="找到0个窗口" width="150" height="34" padding="0,5,0,5" />
+					<Label text="检索结果" width="120" padding="30,0,0,0"/>
+					<Label name="jinezhuaqu_setting_chuangkou_select_value_search_result" text="共找到 0 个窗口" width="420" height="34" padding="0,5,0,5" />
 				</HorizontalLayout>
 			</VerticalLayout>
 			
@@ -99,6 +99,11 @@
 				<Button name="jinezhuaqu_setting_ocr_select_value_search" width="150" height="42" padding="30,0,0,0" text="区域设置" textcolor="#FFFFFFFF" normalimage="file='Btn_Red.png' corner='5,5,5,5'" hotimage="file='Btn_Red_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Red_Click.png' corner='5,5,5,5'" />
 			</HorizontalLayout>
 			
+			<HorizontalLayout height="44">
+				<Label text="操作提示:" width="120" padding="30,0,0,0"/>
+				<Label text="点击区域设置,拖动和拉伸选定区域,鼠标左键双击确认,右键取消" width="450" padding="0,0,0,0"/>
+			</HorizontalLayout>
+			
 			<HorizontalLayout name="jinezhuaqu_setting_ocr_select_value_search_result_layout" padding="0,10,0.0" height="200">
 				<Label text="预览" width="120" padding="30,0,0,0"/>
 				<HorizontalLayout bkcolor="0xFFF3F3F5" width="320" height="200">

+ 7 - 1
bin/Win32/Debug/zhipuzi_pay_plugin/skin/shoukuan_wnd.xml

@@ -60,12 +60,18 @@
 		</VerticalLayout>
 		
 		<VerticalLayout name="shoukuan_pay_success_layout" visible="false">
-			<HorizontalLayout height="100" padding="0,20,0,0">
+			<HorizontalLayout name="shoukuan_pay_success_logo_wx" height="100" padding="0,20,0,0" visible="false">
 				<Control></Control>
 				<Control bkimage="wx_logo.png" width="100" height="100" align="center"></Control>
 				<Control></Control>
 			</HorizontalLayout>
 			
+			<HorizontalLayout name="shoukuan_pay_success_logo_zhifubao" height="100" padding="0,20,0,0" visible="false">
+				<Control></Control>
+				<Control bkimage="zhifubao_logo.png"  width="100" height="100" align="center"></Control>
+				<Control></Control>
+			</HorizontalLayout>
+			
 			<Label height="40" padding="0,20,0,20" name="shoukuan_pay_success_money" text="成功收款:" font="3" textcolor="0xFF3CB371" align="center"></Label>
 			
 			<Label height="60" padding="20,30,20,0" name="shouyin_pay_success_attention" text="按任意键关闭窗口" font="2" textcolor="0xFF808080" multiline="true" align="center" />

BIN
bin/Win32/Debug/zhipuzi_pay_plugin/skin/zhifubao_logo.png


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


+ 4 - 1
zhipuzi_pay_plugin/helper/CBitmapHelper.cpp

@@ -125,6 +125,9 @@ HBITMAP CBitmapHelper::Scale(HBITMAP srcBitmap, int MaxWidth, int MaxHeight)
 
     hNewBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap);
 
+	DeleteDC(hSrcDC);
+	DeleteDC(hMemDC);
+
     return hNewBitmap;
 }
 
@@ -275,7 +278,7 @@ bool CBitmapHelper::OcrRect(tesseract::TessBaseAPI& tess, LPRECT lpRect, std::st
     //正向的内存图象数据
     GetBitmapBits(hBitmap, bi.biSizeImage, lpmem);
 
-    //清除
+    //拿到数据之后,就可以清楚DC了,hBitmap跟着hMemeDC一起清楚
     DeleteDC(hScrDC);
     DeleteDC(hMemDC);
 

+ 6 - 0
zhipuzi_pay_plugin/network/CZhipuziHttpClient.cpp

@@ -73,6 +73,12 @@ bool CZhipuziHttpClient::Login(std::string& errmsg)
         {
             LOG_INFO("login failed! message:" << document["error_msg"].GetString());
             errmsg = std::string(document["error_msg"].GetString());
+
+			if (errcode == 10003)
+			{
+				errmsg = CLewaimaiString::UnicodeToUTF8(L"密码错误");
+			}
+
             return false;
         }
     }

+ 6 - 32
zhipuzi_pay_plugin/wnd/CDingweiInfoWnd.cpp

@@ -24,17 +24,14 @@ void CDingweiInfoWnd::Notify(TNotifyUI& msg)
 
 	if (msg.sType == _T("click"))
 	{
-		if (msg.pSender->GetName() == _T("closebtn"))
+		if (msg.pSender->GetName() == _T("dingweiinfo_wnd_info_confirme"))
 		{
-			PostQuitMessage(0);
-			return;
+			m_valueWnd->ConfirmDingweiWnd(m_findValue, m_FindWnd);
+		}
+		else if (msg.pSender->GetName() == _T("dingweiinfo_wnd_info_quit"))
+		{
+			m_valueWnd->CancalDingweiWnd();
 		}
-	}
-	else if (msg.sType == L"itemclick")
-	{
-		//响应菜单事件
-		::MessageBox(NULL, name.GetData(), L"hello", MB_OK);
-		this->ShowWindow(false);
 	}
 }
 
@@ -146,21 +143,6 @@ LRESULT CDingweiInfoWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b
 	return 0;
 }
 
-LRESULT CDingweiInfoWnd::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{	
-	m_valueWnd->ConfirmDingweiWnd(m_findValue, m_FindWnd);
-
-	return 0;
-}
-
-LRESULT CDingweiInfoWnd::OnRButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-	//点击右键,取消截取
-	m_valueWnd->CancalDingweiWnd();
-
-	return 0;
-}
-
 LRESULT CDingweiInfoWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
 	LRESULT lRes = 0;
@@ -200,14 +182,6 @@ LRESULT CDingweiInfoWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 		lRes = OnSize(uMsg, wParam, lParam, bHandled);
 		break;
 
-	case WM_LBUTTONDOWN:
-		lRes = OnLButtonDown(uMsg, wParam, lParam, bHandled);
-		break;
-
-	case WM_RBUTTONDOWN:
-		lRes = OnRButtonDown(uMsg, wParam, lParam, bHandled);
-		break;
-
 	default:
 		bHandled = FALSE;
 	}

+ 0 - 4
zhipuzi_pay_plugin/wnd/CDingweiInfoWnd.h

@@ -45,10 +45,6 @@ public:
 
 	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
-	LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-
-	LRESULT OnRButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-
 	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);

+ 12 - 0
zhipuzi_pay_plugin/wnd/COcrWnd.cpp

@@ -222,6 +222,10 @@ LRESULT COcrWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 		lRes = OnNcButtonDBClick(uMsg, wParam, lParam, bHandled);
 		break;
 
+	case WM_NCRBUTTONDOWN:
+		lRes = OnNcRButtonDown(uMsg, wParam, lParam, bHandled);
+		break;
+
 	default:
 		bHandled = FALSE;
 	}
@@ -255,3 +259,11 @@ LRESULT COcrWnd::OnNcButtonDBClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
 	bHandled = true;
 	return 0;
 }
+
+LRESULT COcrWnd::OnNcRButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	m_valueWnd->CancelOcr();
+
+	bHandled = true;
+	return 0;
+}

+ 2 - 0
zhipuzi_pay_plugin/wnd/COcrWnd.h

@@ -46,6 +46,8 @@ public:
 
 	LRESULT OnNcButtonDBClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
+	LRESULT OnNcRButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
 	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);

+ 35 - 16
zhipuzi_pay_plugin/wnd/CShoukuanWnd.cpp

@@ -9,10 +9,7 @@
 
 void CShoukuanWnd::Init()
 {
-	//CSpeech::MSSSpeak(L"欢迎使用智铺子收银插件!收款成功123.34元");;
-
-	//wstring path = CSystem::GetProgramDir() + L"\\music\\waimai_new.wav";
-	//PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
+	//CSpeech::MSSSpeak(L"欢迎使用智铺子收银插件!");
 }
 
 void CShoukuanWnd::Notify(TNotifyUI& msg)
@@ -344,6 +341,19 @@ LRESULT CShoukuanWnd::OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam,
 	std::wstring valueInfo = L"成功收款:¥" + m_money;
 	pMoneyPaySuccess->SetText(valueInfo.c_str());
 
+	CHorizontalLayoutUI* wx_logo = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_success_logo_wx")));
+	CHorizontalLayoutUI* zhifubao_logo = static_cast<CHorizontalLayoutUI*>(m_pm.FindControl(_T("shoukuan_pay_success_logo_zhifubao")));
+	if (m_fukuanma_type == 1)
+	{
+		wx_logo->SetVisible(true);
+		zhifubao_logo->SetVisible(false);
+	}
+	else if (m_fukuanma_type == 2)
+	{
+		wx_logo->SetVisible(false);
+		zhifubao_logo->SetVisible(true);
+	}
+
 	SetFocus(m_hWnd);
 
 	bHandled = TRUE;
@@ -438,18 +448,27 @@ void CShoukuanWnd::StartShoukuan()
 		}
 	}
 
-	if (s_Fukuanma.find("10") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("11") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("12") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("13") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("14") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("15") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("25") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("26") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("27") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("28") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("29") == s_Fukuanma.npos \
-		&& s_Fukuanma.find("30") == s_Fukuanma.npos)
+	if (s_Fukuanma.find("10") == 0 \
+		|| s_Fukuanma.find("11") == 0 \
+		|| s_Fukuanma.find("12") == 0 \
+		|| s_Fukuanma.find("13") == 0 \
+		|| s_Fukuanma.find("14") == 0 \
+		|| s_Fukuanma.find("15") == 0)
+	{
+		//微信付款码
+		m_fukuanma_type = 1;
+	}
+	else if (s_Fukuanma.find("25") == 0 \
+		|| s_Fukuanma.find("26") == 0 \
+		|| s_Fukuanma.find("27") == 0 \
+		|| s_Fukuanma.find("28") == 0 \
+		|| s_Fukuanma.find("29") == 0 \
+		|| s_Fukuanma.find("30") == 0)
+	{
+		//支付宝付款码
+		m_fukuanma_type = 2;
+	}
+	else
 	{
 		pLabel->SetText(L"收款码格式不对,请检查后重新输入!");
 		pLabel->SetVisible(true);

+ 1 - 0
zhipuzi_pay_plugin/wnd/CShoukuanWnd.h

@@ -86,6 +86,7 @@ public:
 	std::wstring m_money;
 
 	std::wstring m_fukuanma;
+	int m_fukuanma_type; //付款码类型 1:微信支付 2:支付宝 3:其他的
 
 	std::string m_order_no;
 	std::string m_trade_no;

+ 11 - 1
zhipuzi_pay_plugin/wnd/CSystemSettingWnd.cpp

@@ -778,7 +778,17 @@ void CSystemSettingWnd::FindValueWnd(std::wstring value)
 	result_layout->SetVisible(true);
 
 	CLabelUI* result_label = static_cast<CLabelUI*>(m_pm.FindControl(_T("jinezhuaqu_setting_chuangkou_select_value_search_result")));
-	std::wstring result = L"共找到 " + to_wstring(nCount) + L" 个窗口";
+
+	std::wstring result;
+	if (nCount == 1)
+	{
+		result = L"找到 " + to_wstring(nCount) + L" 个金额匹配的窗口,点击保存按钮开始截取该窗口的金额";
+	}
+	else
+	{
+		result = L"共找到 " + to_wstring(nCount) + L" 个金额匹配的窗口,点击保存按钮开始截取第1个匹配窗口的金额";
+	}
+	
 	result_label->SetText(result.c_str());
 }
 

+ 17 - 1
zhipuzi_pay_plugin/wnd/CValueWnd.cpp

@@ -952,7 +952,14 @@ void CValueWnd::StartDingweiWork()
 			pDingweiInfoWnd->UpdateInfo(lpWindowName, hWnd);
 
 			pDingweiInfoWnd->ShowWindow(true);
-			::SetWindowPos(pDingweiInfoWnd->GetHWND(), HWND_TOPMOST, rect.left, rect.bottom, rect.right - rect.left, 30, SWP_NOACTIVATE);
+
+			int nWidth = rect.right - rect.left;
+			if (nWidth < 380)
+			{
+				nWidth = 380;
+			}
+
+			::SetWindowPos(pDingweiInfoWnd->GetHWND(), HWND_TOPMOST, rect.left, rect.bottom, nWidth, 36, SWP_NOACTIVATE);
 		}
 
 		Sleep(100);
@@ -988,6 +995,15 @@ void CValueWnd::ConfirmOcrWnd(RECT rect)
 	m_settingWnd->ShowWindow(true);
 }
 
+void CValueWnd::CancelOcr()
+{
+	m_is_orc_wnd = false;
+	pOcrWnd->ShowWindow(false);
+
+	//显示设置窗口
+	m_settingWnd->ShowWindow(true);
+}
+
 tesseract::TessBaseAPI& CValueWnd::GetTess()
 {
 	return m_tess;

+ 1 - 0
zhipuzi_pay_plugin/wnd/CValueWnd.h

@@ -94,6 +94,7 @@ public:
 
 	void StartOcrWnd();
 	void ConfirmOcrWnd(RECT rect);
+	void CancelOcr();
 
 	tesseract::TessBaseAPI& GetTess();