Explorar o código

继续优化打印

zhangyang %!s(int64=5) %!d(string=hai) anos
pai
achega
6d6ff62066

+ 16 - 0
bin/Win32/Debug/zhipuzi_pay_plugin/skin/dayinji_setting.xml

@@ -30,6 +30,22 @@
 			</HorizontalLayout>
 		</HorizontalLayout>
 		
+		<HorizontalLayout padding="0,20,0,0" height="36">
+			<CheckBox name="dayinji_setting_auto_print" padding="30,10,0,0" width="16" height="16" normalimage="file='Setting_CheckBox_Normal.png'" hotimage="file='Setting_CheckBox_Hover.png'" selectedimage="file='Setting_CheckBox_Click.png'"/>
+			<Label text="自动打印支付凭证,打印" width="180" padding="10,0,0,0"/>
+			<Edit name="dayinji_setting_print_num" width="40" height="34" padding="0,5,0,5" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+			<Label text="份" width="100" padding="5,0,0,0"></Label>
+			<Button name="dayinji_print_test" width="80" height="36" padding="20,4,0,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'" />
+			<Control></Control>
+		</HorizontalLayout>
+		
+		<HorizontalLayout padding="0,20,0,0" height="36">
+			<Label text="打印尾部空行" width="110" padding="30,0,0,0"/>
+			<Edit name="dayinji_setting_konghang" width="40" height="34" padding="0,5,0,5" normalimage="file='Chat_InputBox_BG.png' corner='4,4,4,4'" hotimage="file='Chat_InputBox_BG_Hover.png' corner='4,4,4,4'" />
+			<Label text="行" width="100" padding="5,0,0,0"></Label>
+			<Control></Control>
+		</HorizontalLayout>
+		
 		<HorizontalLayout height="44" name="dayinji_setting_usb_layout" padding="0,20,0.0">
 			<Label text="USB打印机端口选择" width="180" padding="30,0,0,0"/>
 			<Combo name="dayinji_setting_usb_port" padding="0,9,0,0" width="300" height="26" tooltip="请点击这里选择usb端口" normalimage="file='Setting_Combox_Normal.png' corner='2,2,24,2'" hotimage="file='Setting_Combox_Hover.png' corner='2,2,24,2'" pushedimage="Setting_Combox_Click.png' corner='2,2,24,2'" textpadding="10,1,1,1" >

+ 0 - 531
zhipuzi_pay_plugin/control/CWaimaiOrderInfoUI.cpp

@@ -1,531 +0,0 @@
-#include "../pch/pch.h"
-#include "CWaimaiOrderInfoUI.h"
-
-#include "ControlEx.h"
-
-void CWaimaiOrderInfoUI::DoEvent(TEventUI& event)
-{
-	CVerticalLayoutUI::DoEvent(event);
-}
-
-void CWaimaiOrderInfoUI::Refresh(CWaimaiOrder& order)
-{
-	std::wstring liushuihao_show = L"#" + CLewaimaiString::UTF8ToUnicode(order.m_restaurant_number);
-	this->FindSubControl(_T("waimai_order_info_page_liushuihao"))->SetText(liushuihao_show.c_str());
-
-	std::wstring order_no_show = L"订单号:" + CLewaimaiString::UTF8ToUnicode(order.m_order_no);
-	this->FindSubControl(_T("waimai_order_info_page_order_no"))->SetText(order_no_show.c_str());
-
-	//商品详情的渲染
-	CListUI* pFoodList = static_cast<CListUI*>(this->FindSubControl(_T("waimai_order_info_page_foodlist")));
-	pFoodList->RemoveAll();
-
-	for (std::vector<CWaimaiOrderItem>::iterator it = order.m_order_items.begin(); it != order.m_order_items.end(); it++)
-	{
-		std::string food_name = (*it).m_food_name;
-		std::string food_price = (*it).m_item_price;
-		std::string quantity = (*it).m_quantity;
-
-		CDialogBuilder builder;
-		CListContainerElementUI* pEle = static_cast<CListContainerElementUI *>(builder.Create(_T("waimai_order_info_page_listitem.xml"), (UINT)0, NULL, m_pManager));
-
-		CLabelUI *pName = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_foodname")));
-		pName->SetText(CLewaimaiString::UTF8ToUnicode(food_name).c_str());
-
-		CLabelUI *pQuantity = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_quantity")));
-		pQuantity->SetText(CLewaimaiString::UTF8ToUnicode(quantity).c_str());
-
-		CLabelUI *pPrice = static_cast<CLabelUI *>(pEle->FindSubControl(_T("waimai_order_info_page_listitem_price")));
-		pPrice->SetText(CLewaimaiString::UTF8ToUnicode(food_price).c_str());
-
-		pFoodList->Add(pEle);
-	}
-
-	//重设商品列表的高度
-	int order_item_height = (order.m_order_items.size() + 1) * 30;
-	pFoodList->SetFixedHeight(order_item_height);
-
-	CLabelUI *pMemo = static_cast<CLabelUI *>(this->FindSubControl(_T("waimaorder_info_page_memo")));
-	wstring memo = _T("备注:") + CLewaimaiString::UTF8ToUnicode(order.m_memo);
-	pMemo->SetText(memo.c_str());
-
-	//开始展示各种费用
-	CVerticalLayoutUI* pFeesLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("waimai_order_info_page_fees")));
-	pFeesLayout->RemoveAll();
-
-	int fees_num = 0;
-	
-	if (order.m_delivery > 0)
-	{
-		CLabelUI *pDlieveryFee = new CLabelUI;
-		pDlieveryFee->SetFixedHeight(30);
-
-		wstring delivery_fee = L"配送费:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_delivery, 2));
-		pDlieveryFee->SetText(delivery_fee.c_str());
-
-		pFeesLayout->Add(pDlieveryFee);
-
-		fees_num++;
-	}
-
-	if (order.m_is_dabao == "1")
-	{
-		CLabelUI *pDabaoFee = new CLabelUI;
-		pDabaoFee->SetFixedHeight(30);
-
-		wstring dabao_fee = L"打包费:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_delivery, 2));
-		pDabaoFee->SetText(dabao_fee.c_str());
-
-		pFeesLayout->Add(pDabaoFee);
-
-		fees_num++;
-	}
-
-	//增值服务费
-	if (order.m_addservie.size() > 0)
-	{
-		for (std::vector<CWaimaiOrderField>::iterator it = order.m_addservie.begin(); it != order.m_addservie.end(); it++)
-		{
-			wstring addservice = CLewaimaiString::UTF8ToUnicode((*it).name) + L":" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)atof((*it).value.c_str()), 2));
-
-			CLabelUI* newField = new CLabelUI();
-
-			newField->SetText(addservice.c_str());
-			newField->SetFixedHeight(30);
-
-			pFeesLayout->Add(newField);
-
-			fees_num++;
-		}
-	}
-
-	//店铺折扣
-	if (order.m_discount < 10)
-	{
-		CLabelUI *pDiscountFee = new CLabelUI;
-		pDiscountFee->SetFixedHeight(30);
-
-		wstring discount = L"店铺折扣:" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_discount, 2)) + L"折";
-		pDiscountFee->SetText(discount.c_str());
-
-		pFeesLayout->Add(pDiscountFee);
-
-		fees_num++;
-	}
-
-	//会员优惠
-	if (order.m_is_member_discount == "1")
-	{
-		CLabelUI *pMemberFee = new CLabelUI;
-		pMemberFee->SetFixedHeight(30);
-
-		wstring memberfee = L"会员优惠:-" + CLewaimaiString::UTF8ToUnicode(order.m_member_discount);
-		pMemberFee->SetText(memberfee.c_str());
-
-		pFeesLayout->Add(pMemberFee);
-
-		fees_num++;
-	}
-
-	//首单优惠
-	if (order.m_is_firstcut == "1")
-	{
-		CLabelUI *pFirstCut = new CLabelUI;
-		pFirstCut->SetFixedHeight(30);
-
-		wstring firstcut = L"首单优惠:-" + CLewaimaiString::UTF8ToUnicode(order.m_firstcut_value);
-		pFirstCut->SetText(firstcut.c_str());
-
-		pFeesLayout->Add(pFirstCut);
-
-		fees_num++;
-	}
-
-	//满减
-	string::size_type position = order.m_promotion.find(":");
-	if (position != order.m_promotion.npos)
-	{
-		CLabelUI *pManjian = new CLabelUI;
-		pManjian->SetFixedHeight(30);
-
-		string promotion_value;
-		promotion_value.assign(order.m_promotion, position + 1);
-
-		wstring promotion = L"满减优惠:-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)(atof(promotion_value.c_str())), 2));
-		pManjian->SetText(promotion.c_str());
-
-		pFeesLayout->Add(pManjian);
-
-		fees_num++;
-	}
-
-	//优惠券
-	if (order.m_coupon > 0)
-	{
-		CLabelUI *pCoupon = new CLabelUI;
-		pCoupon->SetMaxHeight(30);
-
-		wstring coupon = L"优惠券:-" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString((double)order.m_coupon, 2));
-		pCoupon->SetText(coupon.c_str());
-
-		pFeesLayout->Add(pCoupon);
-
-		fees_num++;
-	}
-
-	//商品券
-	if (atof(order.m_goods_coupon_value.c_str()) > 0.0001)
-	{
-		CLabelUI *pGoodsCoupon = new CLabelUI;
-		pGoodsCoupon->SetFixedHeight(30);
-
-		wstring goods_coupon = L"商品券:-" + CLewaimaiString::UTF8ToUnicode(order.m_goods_coupon_value);
-		pGoodsCoupon->SetText(goods_coupon.c_str());
-
-		pFeesLayout->Add(pGoodsCoupon);
-
-		fees_num++;
-	}
-
-	int fees_height;
-	if (fees_num == 0)
-	{
-		pFeesLayout->SetVisible(false);
-		this->FindSubControl(_T("waimai_order_info_page_fees_line"))->SetVisible(false);
-
-		fees_height = 0;
-	}
-	else
-	{
-		pFeesLayout->SetVisible(true);
-		this->FindSubControl(_T("waimai_order_info_page_fees_line"))->SetVisible(true);
-		pFeesLayout->SetFixedHeight(fees_num * 30);
-
-		fees_height = fees_num * 30;
-	}
-
-	CLabelUI *pTotalPrice = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_totalprice")));
-	wstring price = L"总计:¥" + CLewaimaiString::UTF8ToUnicode(CLewaimaiString::DoubleToString(order.m_price, 2));
-	pTotalPrice->SetText(price.c_str());
-
-	int nTotalHeight = order_item_height + fees_height + 133;
-	this->FindSubControl(_T("waimai_order_info_page_layout_1"))->SetFixedHeight(nTotalHeight);
-
-	//开始显示顾客信息
-	std::wstring name_show = L"姓名:" + CLewaimaiString::UTF8ToUnicode(order.m_customer_name);
-	this->FindSubControl(_T("waimai_order_info_page_name"))->SetText(name_show.c_str());
-
-	std::wstring phone_show = L"电话:" + CLewaimaiString::UTF8ToUnicode(order.m_phone);
-	this->FindSubControl(_T("waimai_order_info_page_phone"))->SetText(phone_show.c_str());
-
-	std::wstring address_show = L"地址:" + CLewaimaiString::UTF8ToUnicode(order.m_address);
-	this->FindSubControl(_T("waimai_order_info_page_address"))->SetText(address_show.c_str());
-
-	std::wstring order_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(order.m_order_date);
-	this->FindSubControl(_T("waimai_order_info_page_init_date"))->SetText(order_date_show.c_str());
-
-	//开始处理骑手信息
-	if (atoi(order.m_courier_id.c_str()) > 0)
-	{
-		//有人接单了
-		this->FindSubControl(_T("waimai_order_info_page_qishouinfo"))->SetVisible(true);
-
-		std::wstring qishou_name = L"骑手姓名:" + CLewaimaiString::UTF8ToUnicode(order.m_courier_name);
-		this->FindSubControl(_T("waimai_order_info_page_qishou_name"))->SetText(qishou_name.c_str());
-
-		std::wstring qishou_phone = L"骑手电话:" + CLewaimaiString::UTF8ToUnicode(order.m_courier_phone);
-		this->FindSubControl(_T("waimai_order_info_page_qishou_phone"))->SetText(qishou_phone.c_str());
-
-		std::wstring qishou_type;
-		if (order.m_courier_type == "3")
-		{
-			qishou_type = L"骑手类型:快服务骑手";
-		}
-		else if (order.m_courier_type == "5")
-		{
-			qishou_type = L"骑手类型:达达骑手";
-		}
-		else
-		{
-			qishou_type = L"骑手类型:商家自配送骑手";
-		}
-
-		this->FindSubControl(_T("waimai_order_info_page_qishou_type"))->SetText(qishou_type.c_str());
-	}
-	else
-	{
-		this->FindSubControl(_T("waimai_order_info_page_qishouinfo"))->SetVisible(false);
-	}
-
-	//开始处理订单信息
-	if (order.m_is_selftake == "1")
-	{
-		CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type")));
-		wstring wsDeliveryType = _T("配送方式:到店自取(取餐号:") + CLewaimaiString::UTF8ToUnicode(order.m_take_food_code) + _T(")");
-		pDeliveryType->SetText(wsDeliveryType.c_str());
-	}
-	else
-	{
-		CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type")));
-		wstring wsDeliveryType = _T("配送方式:外卖配送");
-		pDeliveryType->SetText(wsDeliveryType.c_str());
-	}
-
-	CLabelUI *pStatus = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_status")));
-	wstring wsStatus = _T("订单状态:") + CLewaimaiString::UTF8ToUnicode(order.m_order_status);
-	if (CLewaimaiString::UTF8ToUnicode(order.m_order_status) == _T("交易失败"))
-	{
-		wsStatus += _T(",失败原因:") + CLewaimaiString::UTF8ToUnicode(order.m_failed_reason);
-	}
-	pStatus->SetText(wsStatus.c_str());
-
-	CLabelUI *pType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_type")));
-	wstring wsType = _T("订单来源:") + CLewaimaiString::UTF8ToUnicode(order.m_from_type);
-	pType->SetText(wsType.c_str());
-
-	//预设选项
-	CVerticalLayoutUI* pLayout = static_cast<CVerticalLayoutUI *>(this->FindSubControl(_T("waimai_order_info_page_field")));
-	pLayout->RemoveAll();
-
-	int order_filed_height;
-	if (order.m_order_field.size() > 1)
-	{
-		for (std::vector<CWaimaiOrderField>::iterator it = order.m_order_field.begin(); it != order.m_order_field.end() - 1; it++)
-		{
-			wstring order_field = CLewaimaiString::UTF8ToUnicode((*it).name) + L":" + CLewaimaiString::UTF8ToUnicode((*it).value);
-
-			CLabelUI* newField = new CLabelUI();
-
-			newField->SetText(order_field.c_str());
-			newField->SetFixedHeight(30);
-
-			pLayout->Add(newField);
-		}
-
-		//这里预设选项默认有一个配送时间,所以要减1
-		pLayout->SetFixedHeight((order.m_order_field.size() - 1) * 30);
-
-		order_filed_height = (order.m_order_field.size() - 1) * 30;
-
-		pLayout->SetVisible(true);
-	}
-	else
-	{
-		order_filed_height = 0;
-
-		pLayout->SetVisible(false);
-	}
-
-	//配送时间
-	wstring delivery_date;
-	if (order.m_is_selftake == "1")
-	{
-		delivery_date = L"自取时间:" + CLewaimaiString::UTF8ToUnicode(order.m_delivery_date);
-	}
-	else
-	{
-		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(order.m_delivery_date);
-	}
-
-	CLabelUI *pTime = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_time")));
-	pTime->SetText(delivery_date.c_str());
-
-	CLabelUI *pPayType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_pay_type")));
-	wstring wsPayType = _T("付款方式:") + CLewaimaiString::UTF8ToUnicode(order.m_pay_type);
-	pPayType->SetText(wsPayType.c_str());
-
-	if (CLewaimaiString::UTF8ToUnicode(order.m_pay_type) == L"货到付款")
-	{
-		this->FindSubControl(_T("waimai_order_info_page_huodaofukuan"))->SetVisible(true);
-	}
-	else
-	{
-		this->FindSubControl(_T("waimai_order_info_page_huodaofukuan"))->SetVisible(false);
-	}
-
-	//右侧按钮的控制
-	CButtonUI* confirm_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_confirme")));
-	CButtonUI* success_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_success")));
-	CButtonUI* fail_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_fail")));
-
-	CButtonUI* agree_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_agree")));
-	CButtonUI* disagree_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_disagree")));
-
-	CButtonUI* refund_button = static_cast<CButtonUI *>(m_pManager->FindControl(_T("waimai_order_info_page_refund")));
-
-	CLabelUI *pRefundStatus = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_refund_status")));
-
-	int refundHeight = 0;
-	if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("未处理")) == 0)
-	{
-		confirm_button->SetVisible(true);
-		success_button->SetVisible(false);
-		fail_button->SetVisible(true);
-
-		agree_button->SetVisible(false);
-		disagree_button->SetVisible(false);
-
-		refund_button->SetVisible(false);
-
-		pRefundStatus->SetVisible(false);
-	}
-	else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("已确认")) == 0)
-	{
-		confirm_button->SetVisible(false);
-		success_button->SetVisible(true);
-		fail_button->SetVisible(true);
-
-		agree_button->SetVisible(false);
-		disagree_button->SetVisible(false);
-
-		refund_button->SetVisible(false);
-
-		pRefundStatus->SetVisible(false);
-	}
-	else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("交易成功")) == 0)
-	{
-		confirm_button->SetVisible(false);
-		success_button->SetVisible(false);
-		fail_button->SetVisible(false);
-
-		agree_button->SetVisible(false);
-		disagree_button->SetVisible(false);
-
-		refund_button->SetVisible(false);
-
-		pRefundStatus->SetVisible(false);
-	}
-	else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("交易失败")) == 0)
-	{
-		confirm_button->SetVisible(false);
-		success_button->SetVisible(false);
-		fail_button->SetVisible(false);
-
-		agree_button->SetVisible(false);
-		disagree_button->SetVisible(false);
-
-		std::string refund_status = m_order.m_refund_status;
-
-		if (CLewaimaiString::UTF8ToUnicode(order.m_pay_type) != L"货到付款")
-		{
-			pRefundStatus->SetVisible(true);
-			refundHeight = 30;
-
-			std::wstring refund_status_text = L"退款状态:";
-			if (refund_status == "0")
-			{
-				refund_button->SetVisible(true);
-				refund_status_text += L"未处理";
-			}
-			else if (refund_status == "10")
-			{
-				refund_button->SetVisible(false);
-				refund_status_text += L"退款处理中,等待退款结果";
-			}
-			else if (refund_status == "11")
-			{
-				refund_button->SetVisible(false);
-				refund_status_text += L"退款已完成";
-			}
-			else if (refund_status == "12")
-			{
-				refund_button->SetVisible(false);
-				refund_status_text += L"退款失败,原因:" + CLewaimaiString::UTF8ToUnicode(order.m_refund_failed_reason);
-			}
-
-			pRefundStatus->SetText(refund_status_text.c_str());
-		}
-		else
-		{
-			refund_button->SetVisible(false);
-
-			pRefundStatus->SetVisible(false);
-		}
-	}
-	else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("已取消")) == 0)
-	{
-		confirm_button->SetVisible(false);
-		success_button->SetVisible(false);
-		fail_button->SetVisible(false);
-
-		agree_button->SetVisible(false);
-		disagree_button->SetVisible(false);
-
-		refund_button->SetVisible(false);
-
-		pRefundStatus->SetVisible(false);
-	}
-	else if (_tcscmp(CLewaimaiString::UTF8ToUnicode(order.m_order_status).c_str(), _T("退款中")) == 0)
-	{
-		confirm_button->SetVisible(false);
-		success_button->SetVisible(false);
-		fail_button->SetVisible(false);
-
-		refund_button->SetVisible(false);
-
-		std::string refund_status = m_order.m_refund_status;
-		if (refund_status == "1")
-		{
-			agree_button->SetVisible(true);
-			disagree_button->SetVisible(true);
-		}
-		else if (refund_status == "5")
-		{
-			agree_button->SetVisible(true);
-			disagree_button->SetVisible(false);
-		}
-		else
-		{
-			agree_button->SetVisible(false);
-			disagree_button->SetVisible(false);
-		}
-
-		pRefundStatus->SetVisible(true);
-
-		refundHeight = 30;
-
-		std::wstring refund_status_text = L"退款状态:";
-		if (refund_status == "1")
-		{
-			refund_status_text += L"顾客申请退款,等待商家处理";
-		}
-		else if (refund_status == "2")
-		{
-			refund_status_text += L"退款成功,订单失败";
-		}
-		else if (refund_status == "3")
-		{
-			refund_status_text += L"商家已拒绝退款,等待顾客受理";
-		}
-		else if (refund_status == "4")
-		{
-			refund_status_text += L"退款失败,订单变为已确认";
-		}
-		else if (refund_status == "5")
-		{
-			refund_status_text += L"顾客再次发起退款,等待客服介入处理中";
-		}
-
-		pRefundStatus->SetText(refund_status_text.c_str());
-	}
-
-	int configMemoHeight = 0;
-	CLabelUI *pConfigmemo = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_configmemo")));
-
-	if (m_order.m_configmemo != "")
-	{
-		configMemoHeight = 30;
-
-		wstring configMemo = L"商家备注:" + CLewaimaiString::UTF8ToUnicode(order.m_configmemo);
-		pConfigmemo->SetText(configMemo.c_str());
-		pConfigmemo->SetVisible(true);
-	}
-	else
-	{
-		configMemoHeight = 0;
-
-		pConfigmemo->SetVisible(false);
-	}
-
-	this->FindSubControl(_T("waimai_order_info_page_layout_3"))->SetFixedHeight(order_filed_height + refundHeight + configMemoHeight + 181);
-}

+ 0 - 26
zhipuzi_pay_plugin/control/CWaimaiOrderInfoUI.h

@@ -1,26 +0,0 @@
-#pragma once
-
-#include "../order/CWaimaiOrder.h"
-
-class CWaimaiOrderInfoUI : public CVerticalLayoutUI
-{
-public:
-	CWaimaiOrderInfoUI()
-	{
-
-	}
-
-	//刷新当前页面的内容,注意这个函数不会改变当前的订单状态以及“页数”
-	void DoEvent(TEventUI& event);
-
-	void SetDate(CWaimaiOrder& order)
-	{
-		m_order = order;
-	}
-
-	//根据外卖订单数据,刷新订单详情页的显示
-	void Refresh(CWaimaiOrder& order);
-
-public:
-	CWaimaiOrder m_order;
-};

+ 0 - 171
zhipuzi_pay_plugin/control/CWaimaiOrderItemUI.cpp

@@ -1,171 +0,0 @@
-#include "../pch/pch.h"
-#include "CWaimaiOrderItemUI.h"
-
-
-CWaimaiOrderItemUI::CWaimaiOrderItemUI()
-{
-}
-
-
-CWaimaiOrderItemUI::~CWaimaiOrderItemUI()
-{
-}
-
-void CWaimaiOrderItemUI::SetData(rapidjson::Value& orderinfo)
-{
-	m_name = orderinfo["customer_name"].GetString();
-	m_address = orderinfo["address"].GetString();
-	m_phone = orderinfo["customer_phone"].GetString();
-	m_price = orderinfo["price"].GetString();
-	m_order_no = orderinfo["order_no"].GetString();
-	m_init_date = orderinfo["init_date"].GetString();
-
-	m_is_selftake = orderinfo["is_selftake"].GetString();
-	m_delivery_date = orderinfo["delivery_date"].GetString();
-	m_deliverytime = orderinfo["delivertime"].GetString();
-
-	m_restaurant_number = orderinfo["restaurant_number"].GetString();
-
-	m_orderid = orderinfo["id"].GetString();
-
-	std::wstring name_show = L"姓名:" + CLewaimaiString::UTF8ToUnicode(m_name);
-	this->FindSubControl(L"waimai_order_list_name")->SetText(name_show.c_str());
-
-	std::wstring address_show = L"地址:" + CLewaimaiString::UTF8ToUnicode(m_address);
-	this->FindSubControl(L"waimai_order_list_address")->SetText(address_show.c_str());
-
-	std::wstring phone_show = L"电话:" + CLewaimaiString::UTF8ToUnicode(m_phone);
-	this->FindSubControl(L"waimai_order_list_phone")->SetText(phone_show.c_str());
-
-	std::wstring price_show = L"价格:" + CLewaimaiString::UTF8ToUnicode(m_price);
-	this->FindSubControl(L"waimai_order_list_price")->SetText(price_show.c_str());
-
-	std::wstring order_no_show = L"#" + CLewaimaiString::UTF8ToUnicode(m_restaurant_number) + L"  订单号:" + CLewaimaiString::UTF8ToUnicode(m_order_no);
-	this->FindSubControl(L"waimai_order_list_order_no")->SetText(order_no_show.c_str());
-
-	std::wstring init_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(m_init_date);
-	this->FindSubControl(L"waimai_order_list_init_date")->SetText(init_date_show.c_str());
-
-	std::wstring order_type;
-	std::wstring delivery_date;
-	if (m_is_selftake == "1")
-	{
-		order_type = L"订单类型:到店自取";
-		delivery_date = L"自取时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
-
-		this->FindSubControl(L"waimai_order_list_ziqu")->SetVisible(true);
-	}
-	else
-	{
-		order_type = L"订单类型:外卖配送";
-		delivery_date = L"配送时间:" + CLewaimaiString::UTF8ToUnicode(m_delivery_date);
-
-		this->FindSubControl(L"waimai_order_list_ziqu")->SetVisible(false);
-	}
-
-	this->FindSubControl(L"waimai_order_list_type")->SetText(order_type.c_str());
-	this->FindSubControl(L"waimai_order_list_delivery_date")->SetText(delivery_date.c_str());
-
-	//显示预约的戳
-	if (m_deliverytime == CLewaimaiString::UnicodeToUTF8(L"尽快送达"))
-	{
-		this->FindSubControl(L"waimai_order_list_yuyue")->SetVisible(false);
-	}
-	else
-	{
-		this->FindSubControl(L"waimai_order_list_yuyue")->SetVisible(true);
-	}
-
-	if (m_status == 1)
-	{
-		this->FindSubControl(L"waimai_order_list_refund_status")->SetVisible(false);
-
-		this->FindSubControl(L"waimai_order_list_confirme")->SetVisible(true);
-		this->FindSubControl(L"waimai_order_list_success")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_fail")->SetVisible(true);
-
-		this->FindSubControl(L"waimai_order_list_agree")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(false);
-	}
-	else if (m_status == 2 || m_status == 3)
-	{
-		this->FindSubControl(L"waimai_order_list_refund_status")->SetVisible(false);
-
-		this->FindSubControl(L"waimai_order_list_confirme")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_success")->SetVisible(true);
-		this->FindSubControl(L"waimai_order_list_fail")->SetVisible(true);
-
-		this->FindSubControl(L"waimai_order_list_agree")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(false);
-	}
-	else if (m_status == 4 || m_status == 5)
-	{
-		this->FindSubControl(L"waimai_order_list_refund_status")->SetVisible(false);
-
-		this->FindSubControl(L"waimai_order_list_confirme")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_success")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_fail")->SetVisible(false);
-
-		this->FindSubControl(L"waimai_order_list_agree")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(false);
-	}
-	else if (m_status == 6)
-	{
-		this->FindSubControl(L"waimai_order_list_refund_status")->SetVisible(false);
-
-		this->FindSubControl(L"waimai_order_list_confirme")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_success")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_fail")->SetVisible(false);
-
-		this->FindSubControl(L"waimai_order_list_agree")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(false);
-	}
-	else if (m_status == 7)
-	{
-		this->FindSubControl(L"waimai_order_list_confirme")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_success")->SetVisible(false);
-		this->FindSubControl(L"waimai_order_list_fail")->SetVisible(false);
-
-		std::string refund_status = orderinfo["refund_status"].GetString();
-		if (refund_status == "1")
-		{
-			this->FindSubControl(L"waimai_order_list_agree")->SetVisible(true);
-			this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(true);
-		}
-		else if (refund_status == "5")
-		{
-			this->FindSubControl(L"waimai_order_list_agree")->SetVisible(true);
-			this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(false);
-		}
-		else
-		{
-			this->FindSubControl(L"waimai_order_list_agree")->SetVisible(false);
-			this->FindSubControl(L"waimai_order_list_disagree")->SetVisible(false);
-		}
-
-		this->FindSubControl(L"waimai_order_list_refund_status")->SetVisible(true);
-		std::wstring refund_status_text = L"退款状态:";
-		if (refund_status == "1")
-		{
-			refund_status_text += L"顾客申请退款,等待商家处理";
-		}
-		else if (refund_status == "2")
-		{
-			refund_status_text += L"退款成功,订单失败";
-		}
-		else if (refund_status == "3")
-		{
-			refund_status_text += L"商家已拒绝退款,等待顾客受理";
-		}
-		else if (refund_status == "4")
-		{
-			refund_status_text += L"退款失败,订单变为已确认";
-		}
-		else if (refund_status == "5")
-		{
-			refund_status_text += L"顾客再次发起退款,等待客服介入处理中";
-		}
-
-		this->FindSubControl(L"waimai_order_list_refund_status")->SetText(refund_status_text.c_str());
-	}
-}

+ 0 - 55
zhipuzi_pay_plugin/control/CWaimaiOrderItemUI.h

@@ -1,55 +0,0 @@
-#pragma once
-
-#include "../pch/pch.h"
-
-class CWaimaiOrderItemUI : public CHorizontalLayoutUI
-{
-public:
-	CWaimaiOrderItemUI();
-	~CWaimaiOrderItemUI();
-
-	void SetData(rapidjson::Value& orderinfo);
-
-	std::string getOrderID()
-	{
-		return m_orderid;
-	}
-
-	std::string getOrderNo()
-	{
-		return m_order_no;
-	}
-
-	void SetStatus(int status)
-	{
-		m_status = status;
-	}
-
-	void DoEvent(TEventUI& event)
-	{
-		if (event.Type == UIEVENT_BUTTONDOWN)
-		{
-			int a = 1;
-		}
-		CHorizontalLayoutUI::DoEvent(event);
-	}
-
-private:
-	std::string m_name;
-	std::string m_address;
-	std::string m_phone;
-	std::string m_price;
-	std::string m_order_no;
-	std::string m_init_date;
-
-	std::string m_is_selftake;
-	std::string m_delivery_date;
-	std::string m_deliverytime;
-
-	std::string m_restaurant_number;
-
-	std::string m_orderid;
-
-	int m_status = 1; //1:未处理 2:已确认 3:配送中 4:成功 5:失败 6:已取消 7:退款中
-};
-

+ 1 - 16
zhipuzi_pay_plugin/control/ControlEx.h

@@ -2,9 +2,6 @@
 
 #include "../pch/pch.h"
 
-#include "CWaimaiOrderItemUI.h"
-#include "OrderListUI.h"
-#include "CWaimaiOrderInfoUI.h"
 #include "CSettingUI.h"
 #include "CJineZhuaquUI.h"
 #include "CMenuItemUI.h"
@@ -14,19 +11,7 @@ class CDialogBuilderCallbackEx : public IDialogBuilderCallback
 public:
 	CControlUI* CreateControl(LPCTSTR pstrClass)
 	{
-		if (_tcscmp(pstrClass, _T("WaimaiOrderList")) == 0)
-		{
-			return new OrderListUI;
-		}
-		else if (_tcscmp(pstrClass, _T("WaimaiOrderItem")) == 0)
-		{
-			return new CWaimaiOrderItemUI;
-		}
-		else if (_tcscmp(pstrClass, _T("WaimaiOrderInfo")) == 0)
-		{
-			return new CWaimaiOrderInfoUI;
-		}
-		else if (_tcscmp(pstrClass, _T("Setting")) == 0)
+		if (_tcscmp(pstrClass, _T("Setting")) == 0)
 		{
 			return new CSettingUI;
 		}

+ 0 - 235
zhipuzi_pay_plugin/control/OrderListUI.cpp

@@ -1,235 +0,0 @@
-#include "../pch/pch.h"
-#include "OrderListUI.h"
-
-#include "CWaimaiOrderItemUI.h"
-
-#include "ControlEx.h"
-
-OrderListUI::OrderListUI()
-{
-	
-}
-
-OrderListUI::~OrderListUI()
-{
-	
-}
-
-void OrderListUI::Refresh()
-{
-	//开始转菊花
-	this->SetVisible(false);
-
-	m_pManager->FindControl(_T("main_orderlist_loading"))->SetVisible(true);
-
-	//启动一个线程,进行网络请求操作
-	OrderListStatus* status =  new OrderListStatus;
-	status->m_status = m_status;
-	status->m_page = m_page;
-
-	std::thread t(&OrderListUI::HandleRefresh, this, status);
-	t.detach();
-}
-
-void OrderListUI::HandleRefresh(OrderListStatus* status)
-{
-	std::string url;
-	if (status->m_status == 1)
-	{
-		url = "/waimaiorder/getopenlist";
-	}
-	else if (status->m_status == 2)
-	{
-		url = "/waimaiorder/getconfirmedlist";
-	}
-	else if (status->m_status == 3)
-	{
-		url = "/waimaiorder/getdeliverylist";
-	}
-	else if (status->m_status == 4)
-	{
-		url = "/waimaiorder/getsucceededlist";
-	}
-	else if (status->m_status == 5)
-	{
-		url = "/waimaiorder/getfailedlist";
-	}
-	else if (status->m_status == 6)
-	{
-		url = "/waimaiorder/getcancelledlist";
-	}
-	else if (status->m_status == 7)
-	{
-		url = "/waimaiorder/getrefundlist";
-	}
-
-	//请求外卖的未处理订单,直接用当前的page值去请求
-	std::map<string, string> params;
-	params["page"] = to_string(status->m_page);
-	std::string response;
-
-	CZhipuziHttpClient::Request(url.c_str(), params, response);
-
-	//走到这里,网络请求结束了,对比状态是否发生了改变
-	if (status->m_page != m_page || status->m_status != m_status)
-	{
-		//用户已经点击了其他状态,这个状态结果无效了,直接返回
-		delete status;
-		return;
-	}
-		
-	//将网络返回结果保存起来,等待消息处理重新渲染页面
-	m_response = response;
-
-	::PostMessage(m_pManager->GetPaintWindow(), WM_ORDERLIST_REFRESH, 0, 0);
-
-	delete status;
-}
-
-void OrderListUI::DoRefresh()
-{
-	//请求成功之后,清空之前的数据
-	this->RemoveAll();
-
-	rapidjson::Document document;
-	document.Parse(m_response.c_str());
-
-	if (document.HasParseError())
-	{
-		LOG_INFO("parse response error!");
-		return;
-	}
-
-	if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-	{
-		LOG_INFO("json error!");
-		return;
-	}
-
-	rapidjson::Value& v_errcode = document["errcode"];
-	int errcode = v_errcode.GetInt();
-	if (errcode != 0)
-	{
-		LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-		return;
-	}
-
-	//获得数据成功
-	rapidjson::Value& data = document["data"];
-
-	rapidjson::Value& v_count = data["count"];
-	string count = v_count.GetString();
-
-	//处理页数
-	int nCount = atoi(count.c_str());
-	m_total_page = (int)ceil(nCount / 20.0);
-	if (m_total_page < 1)
-	{
-		m_total_page = 1;
-	}
-
-	if (m_page <= 1)
-	{
-		m_page = 1;
-		CButtonUI* pControl = static_cast<CButtonUI*>(m_pManager->FindControl(_T("waimai_order_list_last")));
-		pControl->SetEnabled(false);
-	}
-	if (m_page >= m_total_page)
-	{
-		m_page = m_total_page;
-		CButtonUI* pControl = static_cast<CButtonUI*>(m_pManager->FindControl(_T("waimai_order_list_next")));
-		pControl->SetEnabled(false);
-	}
-
-	if (m_page > 1)
-	{
-		CButtonUI* pControl = static_cast<CButtonUI*>(m_pManager->FindControl(_T("waimai_order_list_last")));
-		pControl->SetEnabled(true);
-	}
-	if (m_page < m_total_page)
-	{
-		CButtonUI* pControl = static_cast<CButtonUI*>(m_pManager->FindControl(_T("waimai_order_list_next")));
-		pControl->SetEnabled(true);
-	}
-
-	CLabelUI* pControl = static_cast<CLabelUI*>(m_pManager->FindControl(_T("waimai_order_list_page")));
-	wstring pageinfo = _T("第 ") + CLewaimaiString::ANSIToUnicode(to_string(m_page)) + _T("页/共 ") + CLewaimaiString::ANSIToUnicode(to_string(m_total_page)) + _T("页");
-	pControl->SetText(pageinfo.c_str());
-
-	rapidjson::Value& v_rows = data["rows"];
-
-	for (rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
-	{
-		rapidjson::Value& v_row_i = v_rows[i];
-
-		//创建一个对象
-		CDialogBuilder builder;
-		CDialogBuilderCallbackEx cb;
-
-		CWaimaiOrderItemUI* pItem = static_cast<CWaimaiOrderItemUI*>(builder.Create(_T("waimai_order_item.xml"), (UINT)0, &cb, m_pManager));
-		if (pItem != NULL)
-		{
-			//初始化该对应的数据
-			pItem->SetStatus(m_status);
-
-			pItem->SetData(v_row_i);
-
-			this->Add(pItem);
-
-			pItem = NULL;
-		}
-		else
-		{
-			LOG_INFO("create waimai_order_item fail!");
-		}
-	}
-
-	//重置滚动条的位置
-	tagSIZE size;
-	size.cx = 0;
-	size.cy = 0;
-	this->SetScrollPos(size);
-
-	this->SetVisible(true);
-
-	m_pManager->FindControl(_T("main_orderlist_loading"))->SetVisible(false);
-}
-
-void OrderListUI::LastPage()
-{
-	m_page--;
-	if (m_page < 1)
-	{
-		m_page = 1;
-	}
-
-	if (m_page == 1)
-	{
-		CButtonUI* pControl = static_cast<CButtonUI*>(m_pManager->FindControl(_T("waimai_order_list_last")));
-		pControl->SetEnabled(false);
-	}
-
-	Refresh();
-}
-
-void OrderListUI::NextPage()
-{
-	m_page++;
-	if (m_page > m_total_page)
-	{
-		m_page = m_total_page;
-	}
-
-	if (m_page == m_total_page)
-	{
-		CButtonUI* pControl = static_cast<CButtonUI*>(m_pManager->FindControl(_T("waimai_order_list_next")));
-		pControl->SetEnabled(false);
-	}
-
-	Refresh();
-}
-
-void OrderListUI::DoEvent(TEventUI& event)
-{
-	CVerticalLayoutUI::DoEvent(event);
-}

+ 0 - 47
zhipuzi_pay_plugin/control/OrderListUI.h

@@ -1,47 +0,0 @@
-#pragma once
-
-class OrderListStatus
-{
-public:
-	int m_status;
-	int m_page;
-};
-
-class OrderListUI : public CVerticalLayoutUI
-{
-public:
-	OrderListUI();
-
-	~OrderListUI();
-
-    //刷新当前页面的内容,注意这个函数不会改变当前的订单状态以及“页数”
-    void Refresh();
-
-	void LastPage();
-
-	void NextPage();
-
-	void DoEvent(TEventUI& event);
-
-	void SetStatus(int status)
-	{
-		m_status = status;
-	}
-
-	void SetPage(int n)
-	{
-		m_page = n;
-	}
-
-	void HandleRefresh(OrderListStatus* status);
-
-	void DoRefresh();
-
-private:
-    int m_status = 1; //1:未处理 2:已确认 3:配送中 4:成功 5:失败 6:已取消 7:退款中
-	int m_page = 1;
-
-	int m_total_page; //总页数
-
-	std::string m_response;
-};

+ 25 - 415
zhipuzi_pay_plugin/network/CMessagePush.cpp

@@ -2,11 +2,6 @@
 #include "CMessagePush.h"
 
 #include "../tool/CPosPrinter.h"
-#include "../order/CWaimaiOrder.h"
-
-#include "mmsystem.h"
-
-#include "PosMessage.h"
 
 CMessagePush::~CMessagePush()
 {
@@ -19,290 +14,21 @@ void CMessagePush::Start()
 
     m_nStopNum = 0;
 
-    //心跳包
-    std::thread(&CMessagePush::KeepAlive, this).detach();
-
-    //接收消息
-    std::thread(&CMessagePush::ReceiveMessage, this).detach();
-
-    //处理声音提醒
-    std::thread(&CMessagePush::HandleVoice, this).detach();
-
-    //处理订单确认
-    std::thread(&CMessagePush::HandleConfirm, this).detach();
-
     //处理打印
     std::thread(&CMessagePush::HandlePrinter, this).detach();
-
-    //处理收银打印
-    std::thread(&CMessagePush::HandleShouyinPrinter, this).detach();
 }
 
 void CMessagePush::Stop()
 {
     m_is_work = false;
-
-    socket_.close();
-
-    m_voice_mutex.lock();
-    while(!m_voice_queue.empty())
-    {
-        m_voice_queue.pop();
-    }
-    m_voice_mutex.unlock();
-
-    m_confirm_mutex.lock();
-    while(!m_confirm_queue.empty())
-    {
-        m_confirm_queue.pop();
-    }
-    m_confirm_mutex.unlock();
-
-    m_printer_mutex.lock();
-    while(!m_printer_queue.empty())
-    {
-        m_printer_queue.pop();
-    }
-    m_printer_mutex.unlock();
-
-    m_shouyin_printer_mutex.lock();
-    while(!m_shouyin_printer_queue.empty())
-    {
-        m_shouyin_printer_queue.pop();
-    }
-    m_shouyin_printer_mutex.unlock();
-
-    m_chufang_printer_mutex.lock();
-    while(!m_chufang_printer_queue.empty())
-    {
-        m_chufang_printer_queue.pop();
-    }
-    m_chufang_printer_mutex.unlock();
-}
-
-void CMessagePush::KeepAlive()
-{
-    while(m_is_work)
-    {
-        //生成心跳包
-        rapidjson::Document doc;
-        doc.SetObject();
-        rapidjson::Document::AllocatorType& allocator = doc.GetAllocator(); //获取分配器
-
-        std::string username = CSetting::getUsername();
-        std::string timestamp = to_string(time(NULL));
-        doc.AddMember("username", StringRef(username.c_str(), username.length()), allocator);
-        doc.AddMember("timestamp", StringRef(timestamp.c_str(), timestamp.length()), allocator);
-        doc.AddMember("is_login", "0", allocator);
-
-        rapidjson::StringBuffer buffer;
-        rapidjson::Writer<StringBuffer> writer(buffer);
-        doc.Accept(writer);
-
-        //返回给接入层的消息
-        std::string m_keepalive_msg = buffer.GetString();
-
-        PosMessage new_msg;
-        new_msg.m_length = m_keepalive_msg.length();
-        memcpy(new_msg.data, m_keepalive_msg.c_str(), m_keepalive_msg.length());
-        new_msg.data[new_msg.m_length] = '\0';
-
-        try
-        {
-            socket_.write_some(boost::asio::buffer(&new_msg, sizeof(PosMessage)));
-        }
-        catch(const std::exception& e)
-        {
-            //走到这里来说明心跳包发送失败了,socket失效了
-            std::string err = e.what();
-
-            //先把socket关闭掉
-            socket_.close();
-
-            try
-            {
-                //发送失败,重新建立连接
-                char host[] = "pushserver.zhipuzi.com";
-                char port[] = "9001";
-
-                tcp::resolver resolver(m_io_context);
-                tcp::resolver::results_type endpoints =
-                    resolver.resolve(tcp::v4(), host, port);
-
-                boost::asio::connect(socket_, endpoints);
-
-                //刚刚连接上,这是第一次登陆,发送登陆信息
-                rapidjson::Document doc_1;
-                doc_1.SetObject();
-                rapidjson::Document::AllocatorType& allocator_1 = doc_1.GetAllocator(); //获取分配器
-
-                std::string username_1 = CSetting::getUsername();
-                std::string timestamp_1 = to_string(time(NULL));
-                doc_1.AddMember("username", StringRef(username_1.c_str(), username_1.length()), allocator_1);
-                doc_1.AddMember("timestamp", StringRef(timestamp_1.c_str(), timestamp_1.length()), allocator_1);
-                doc_1.AddMember("is_login", "1", allocator_1);
-
-                rapidjson::StringBuffer buffer_1;
-                rapidjson::Writer<StringBuffer> writer_1(buffer_1);
-                doc_1.Accept(writer_1);
-
-                //返回给接入层的消息
-                std::string m_login_message = buffer_1.GetString();
-
-                PosMessage login_msg;
-                login_msg.m_length = m_login_message.length();
-                memcpy(login_msg.data, m_login_message.c_str(), m_login_message.length());
-                login_msg.data[login_msg.m_length] = '\0';
-
-                socket_.write_some(boost::asio::buffer(boost::asio::buffer(&login_msg, sizeof(PosMessage))));
-            }
-            catch(const std::exception& e)
-            {
-                //重新连接或者重新发送又失败了,可能是网络断了
-                std::string err = e.what();
-                LOG_INFO("write err info:" << err.c_str());
-
-                //关闭无效的连接
-                socket_.close();
-
-                //30秒后再重试
-                CSystem::my_sleep(30);
-
-                continue;
-            }
-        }
-
-        //走到这里,说明心跳包发送成功了,socket是连通的
-
-        //休眠30秒钟,之后再发心跳包
-        CSystem::my_sleep(30);
-    }
-
-    AddStopNum();
 }
 
-void CMessagePush::ReceiveMessage()
-{
-    while(m_is_work)
-    {
-        try
-        {
-            PosMessage new_msg;
-
-            boost::asio::read(socket_, boost::asio::buffer(&new_msg, sizeof(PosMessage)));
-
-            std::string msg = new_msg.data;
-
-            //收到服务器的消息,对服务器的消息进行处理
-            rapidjson::Document document;
-            document.Parse(msg.c_str());
-            if(!document.IsObject())
-            {
-                LOG_INFO("message 非法!");
-                return;
-            }
-
-            std::string type;
-            if(document["msg_type"].IsInt())
-            {
-                type = to_string(document["msg_type"].GetInt());
-            }
-            else
-            {
-                type = document["msg_type"].GetString();
-            }
-
-            if(type == "1")
-            {
-                std::string order_id = document["waimai_order_id"].GetString();
-                std::string order_no = document["waimai_order_no"].GetString();
-
-                //新订单来了,首先判断是否要语音提醒
-                if(CSetting::GetParam("setting_is_new_waimai_voice") == "1")
-                {
-                    if(CSetting::GetParam("setting_is_new_waimai_autoconfirm") == "1")
-                    {
-                        AddVoice(2);
-                    }
-                    else
-                    {
-                        AddVoice(1);
-                    }
-                }
-
-                //判断是否要自动确认
-                if(CSetting::GetParam("setting_is_new_waimai_autoconfirm") == "1")
-                {
-                    AddConfirm(order_id);
-                }
-
-                //判断是否右下角弹框提醒
-                if(CSetting::GetParam("setting_is_new_waimai_dialog") == "1")
-                {
-
-                }
-
-                AddPinter(order_id, order_no, 1);
-            }
-            else if(type == "2")
-            {
-                AddVoice(3);
-            }
-            else if(type == "3")
-            {
-                AddVoice(4);
-            }
-            else if(type == "0")
-            {
-                //这个表示被人挤下线了
-                PostMessage(m_hwnd, WM_LOGIN_AGAIN_OUT, 0, 0);
-            }
-
-            //处理完了,接着处理下一条
-            continue;
-        }
-        catch(std::exception& e)
-        {
-            std::string err = e.what();
-            LOG_INFO("read err:" << err.c_str());
-
-            //如果这里异常了,说明socket失效了,等2秒重新读
-            CSystem::my_sleep(2);
-            continue;
-        }
-    }
-
-    AddStopNum();
-}
-
-/*
- *类型 1:新外卖订单 2:新外卖订单自动接单 3:外卖订单取消 4:外卖订单退款
- **/
-void CMessagePush::AddVoice(int voice_type)
-{
-    m_voice_mutex.lock();
-
-    m_voice_queue.push(voice_type);
-
-    m_voice_mutex.unlock();
-}
-
-void CMessagePush::AddConfirm(std::string order_id)
-{
-    m_confirm_mutex.lock();
-
-    m_confirm_queue.push(order_id);
-
-    m_confirm_mutex.unlock();
-}
-
-void CMessagePush::AddPinter(std::string order_id, std::string order_no, int print_type)
+void CMessagePush::AddPinter(std::string out_order_no, int print_type)
 {
     m_printer_mutex.lock();
 
-    WaimaiPinterInfo newPrinter;
-    newPrinter.order_id = order_id;
-    newPrinter.order_no = order_no;
+    ShouyinPinterInfo newPrinter;
+    newPrinter.out_order_no = out_order_no;
     newPrinter.print_type = print_type;
 
     m_printer_queue.push(newPrinter);
@@ -310,87 +36,6 @@ void CMessagePush::AddPinter(std::string order_id, std::string order_no, int pri
     m_printer_mutex.unlock();
 }
 
-void CMessagePush::AddShouyinPrinter(CWaimaiOrder order)
-{
-    m_shouyin_printer_mutex.lock();
-
-    m_shouyin_printer_queue.push(order);
-
-    m_shouyin_printer_mutex.unlock();
-}
-
-void CMessagePush::HandleVoice()
-{
-    while(m_is_work)
-    {
-        m_voice_mutex.lock();
-
-        if(m_voice_queue.empty())
-        {
-            m_voice_mutex.unlock();
-
-            CSystem::my_sleep(1);
-            continue;
-        }
-
-        int voice_type = m_voice_queue.front();
-        m_voice_queue.pop();
-
-        m_voice_mutex.unlock();
-
-        if(voice_type == 1)
-        {
-            wstring path = CSystem::GetProgramDir() + L"\\music\\waimai_new.wav";
-            PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
-        }
-        else if(voice_type == 2)
-        {
-            wstring path = CSystem::GetProgramDir() + L"\\music\\waimai_new_auto.wav";
-            PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
-        }
-        else if(voice_type == 3)
-        {
-            wstring path = CSystem::GetProgramDir() + L"\\music\\waimai_quxiao.wav";
-            PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
-        }
-        else if(voice_type == 4)
-        {
-            wstring path = CSystem::GetProgramDir() + L"\\music\\waimai_tuikuan.wav";
-            PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
-        }
-
-        //8秒内最多播放一次
-        CSystem::my_sleep(8);
-    }
-
-    AddStopNum();
-}
-
-void CMessagePush::HandleConfirm()
-{
-    while(m_is_work)
-    {
-        m_confirm_mutex.lock();
-
-        if(m_confirm_queue.empty())
-        {
-            m_confirm_mutex.unlock();
-
-            CSystem::my_sleep(1);
-            continue;
-        }
-
-        std::string order_id = m_confirm_queue.front();
-        m_confirm_queue.pop();
-
-        m_confirm_mutex.unlock();
-
-        CWaimaiOrder newOrder;
-        newOrder.ConfirmeOrder(order_id);
-    }
-
-    AddStopNum();
-}
 
 void CMessagePush::HandlePrinter()
 {
@@ -406,74 +51,39 @@ void CMessagePush::HandlePrinter()
             continue;
         }
 
-        WaimaiPinterInfo printerInfo = m_printer_queue.front();
-        std::string order_id = printerInfo.order_id;
-        std::string order_no = printerInfo.order_no;
+        ShouyinPinterInfo printerInfo = m_printer_queue.front();
+        std::string out_order_no = printerInfo.out_order_no;
         int print_type = printerInfo.print_type;
 
         m_printer_queue.pop();
 
         m_printer_mutex.unlock();
-
-        CWaimaiOrder order;
+        
         if(print_type == 1)
         {
-            if(CSetting::GetParam("setting_is_new_waimai_printer") == "1" || CSetting::GetParam("setting_is_new_waimai_chufang_printer") == "1")
-            {
-                bool ret = order.InitData(order_id, order_no);
-
-                if(ret == false)
-                {
-                    this->AddPinter(order_id, order_no, print_type);
-                    continue;
-                }
-            }
+            //支付成功订单
+			CShouyinOrder order;
+			bool ret = order.InitData(out_order_no);
 
-            //判断是否自动打印收银小票
-            if(CSetting::GetParam("setting_is_new_waimai_printer") == "1")
-            {
-                AddShouyinPrinter(order);
-            }
+			CPosPrinter printer;
+			printer.PrintZhifu(order);
         }
+		else if (print_type == 2)
+		{
+			//退款成功订单
+			CShouyinOrder order;
+			bool ret = order.InitData(out_order_no);
+
+			CPosPrinter printer;
+			printer.PrintTuikuan(order);
+		}
         else
         {
-            bool ret = order.InitData(order_id, order_no);
-
-            if(ret == false)
-            {
-                this->AddPinter(order_id, order_no, print_type);
-                continue;
-            }
-
-            AddShouyinPrinter(order);
-        }
-    }
-
-    AddStopNum();
-}
-
-void CMessagePush::HandleShouyinPrinter()
-{
-    while(m_is_work)
-    {
-        m_shouyin_printer_mutex.lock();
-
-        if(m_shouyin_printer_queue.empty())
-        {
-            m_shouyin_printer_mutex.unlock();
-
-            CSystem::my_sleep(1);
-            continue;
+			//打印测试的订单
+			CPosPrinter printer;
+			printer.PrintTest();
+			
         }
-
-        CWaimaiOrder order = m_shouyin_printer_queue.front();
-
-        m_shouyin_printer_queue.pop();
-
-        m_shouyin_printer_mutex.unlock();
-
-        CPosPrinter printer;
-        printer.PrintWaimaiOrderShouyin(order);
     }
 
     AddStopNum();
@@ -487,7 +97,7 @@ void CMessagePush::AddStopNum()
 
     m_nStopNumMutex.unlock();
 
-    if(m_nStopNum == 7)
+    if(m_nStopNum == 1)
     {
         //确认所有子线程都退出了,再删除自己
         delete this;

+ 6 - 46
zhipuzi_pay_plugin/network/CMessagePush.h

@@ -1,33 +1,19 @@
 #pragma once
 
 #include "../pch/pch.h"
-#include "../order/CWaimaiOrder.h"
+#include "../order/CShouyinOrder.h"
 
-using boost::asio::ip::tcp;
-
-class CClientMessage
-{
-public:
-    int m_type; //消息类型 0:新的外卖订单
-
-    std::string m_username;
-    std::string m_order_id;
-    std::string m_order_no;
-};
-
-class WaimaiPinterInfo
+class ShouyinPinterInfo
 {
 public:
-    std::string order_id;
-    std::string order_no;
-    int print_type; //打印类型 1:新订单自动打印 2:手动打印
+    std::string out_order_no;
+    int print_type; //打印类型 1:支付成功 2:退款成功 3:打印测试
 };
 
 class CMessagePush
 {
 public:
     CMessagePush(HWND hwnd)
-        : socket_(m_io_context)
     {
         m_hwnd = hwnd;
     }
@@ -40,22 +26,10 @@ public:
     //停止工作
     void Stop();
 
-    //发送心跳包
-    void KeepAlive();
-
-    //专门处理推送消息
-    void ReceiveMessage();
-
     //队列处理
-    void HandleVoice();
-    void HandleConfirm();
     void HandlePrinter();
-    void HandleShouyinPrinter();
 
-    void AddVoice(int voice_type);
-    void AddConfirm(std::string order_id);
-    void AddPinter(std::string order_id, std::string order_no, int print_type);
-    void AddShouyinPrinter(CWaimaiOrder order);
+    void AddPinter(std::string out_order_no, int print_type);
 
 private:
     void AddStopNum();
@@ -66,23 +40,9 @@ private:
     int m_nStopNum = 0;
     std::mutex m_nStopNumMutex;
 
-    boost::asio::io_context m_io_context;
-    tcp::socket socket_;
-
-    enum { max_length = 1024 };
-    char data_[max_length];
-
-    std::queue<int> m_voice_queue;
-    std::queue<std::string> m_confirm_queue;
-    std::queue<WaimaiPinterInfo> m_printer_queue;
-    std::queue<CWaimaiOrder> m_shouyin_printer_queue;
-    std::queue<CWaimaiOrder> m_chufang_printer_queue;
+    std::queue<ShouyinPinterInfo> m_printer_queue;
 
-    std::mutex m_voice_mutex;
-    std::mutex m_confirm_mutex;
     std::mutex m_printer_mutex;
-    std::mutex m_shouyin_printer_mutex;
-    std::mutex m_chufang_printer_mutex;
 
     HWND m_hwnd;
 };

+ 0 - 10
zhipuzi_pay_plugin/network/PosMessage.h

@@ -1,10 +0,0 @@
-#pragma once
-
-class PosMessage
-{
-public:
-	enum { max_length = 1024 };
-	char data[max_length];
-
-	int m_length;
-};

+ 56 - 0
zhipuzi_pay_plugin/order/CShouyinOrder.cpp

@@ -0,0 +1,56 @@
+#include "../pch/pch.h"
+#include "CShouyinOrder.h"
+
+CShouyinOrder::CShouyinOrder()
+{
+}
+
+
+CShouyinOrder::~CShouyinOrder()
+{
+}
+
+//通过订单ID,获取订单详情
+bool CShouyinOrder::InitData(std::string out_order_no)
+{
+    std::map<string, string> params;
+    params["out_order_no"] = out_order_no;
+
+    std::string response;
+    bool ret = CZhipuziHttpClient::Request("/waimaiorder/getorderdetail", params, response);
+    if(!ret)
+    {
+        LOG_INFO("网络请求出错");
+        return false;
+    }
+
+    rapidjson::Document document;
+    document.Parse(response.c_str());
+
+    if(document.HasParseError())
+    {
+        LOG_INFO("parse response error!");
+        return false;
+    }
+    else
+    {
+        if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+        {
+            LOG_INFO("json error!");
+            return false;
+        }
+
+        rapidjson::Value& v_errcode = document["errcode"];
+        int errcode = v_errcode.GetInt();
+        if(errcode != 0)
+        {
+            LOG_INFO("response failed! message:" << document["errmsg"].GetString());
+            return false;
+        }
+
+        //获得数据成功
+        rapidjson::Value& data = document["data"];            
+    }
+
+    return true;
+}

+ 29 - 0
zhipuzi_pay_plugin/order/CShouyinOrder.h

@@ -0,0 +1,29 @@
+#pragma once
+
+#include <string>
+#include <vector>
+
+class CShouyinOrder
+{
+public:
+    CShouyinOrder();
+    ~CShouyinOrder();
+
+    bool InitData(std::string out_order_no);
+
+public:
+	std::string m_order_no;
+	std::string m_shopname;
+	std::string m_shouyinyuanname;
+	std::string m_value;
+	std::string m_zhifu_type;
+	std::string m_out_trade_no;
+	std::string m_trade_no;
+	std::string m_is_refund;
+	std::string m_refund_result;
+	std::string m_refund_trade_no;
+	std::string m_refund_money;
+	std::string m_refund_time;
+	std::string m_init_time;
+};
+

+ 0 - 394
zhipuzi_pay_plugin/order/CWaimaiOrder.cpp

@@ -1,394 +0,0 @@
-#include "../pch/pch.h"
-#include "CWaimaiOrder.h"
-
-CWaimaiOrder::CWaimaiOrder()
-{
-}
-
-
-CWaimaiOrder::~CWaimaiOrder()
-{
-}
-
-//通过订单ID,获取订单详情
-bool CWaimaiOrder::InitData(std::string order_id, std::string order_no)
-{
-    std::map<string, string> params;
-    params["id"] = order_id;
-    params["order_no"] = order_no;
-
-    std::string response;
-    bool ret = CZhipuziHttpClient::Request("/waimaiorder/getorderdetail", params, response);
-    if(!ret)
-    {
-        LOG_INFO("网络请求出错");
-        return false;
-    }
-
-    rapidjson::Document document;
-    document.Parse(response.c_str());
-
-    if(document.HasParseError())
-    {
-        LOG_INFO("parse response error!");
-        return false;
-    }
-    else
-    {
-        if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-        {
-            LOG_INFO("json error!");
-            return false;
-        }
-
-        rapidjson::Value& v_errcode = document["errcode"];
-        int errcode = v_errcode.GetInt();
-        if(errcode != 0)
-        {
-            LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-            return false;
-        }
-        {
-            //获得数据成功
-            rapidjson::Value& data = document["data"];
-
-            m_order_id = data["id"].GetString();
-            m_shop_id = data["shop_id"].GetString();
-            m_restaurant_number = data["restaurant_number"].GetString();
-            m_customer_id = data["customer_id"].GetString();
-            m_customer_name = data["customer_name"].GetString();
-            m_phone = data["phone"].GetString();
-            m_address = data["address"].GetString();
-            m_memo = data["memo"].GetString();
-            m_pay_type = data["pay_type"].GetString();
-            m_promotion = data["promotion"].GetString();
-            m_is_member_discount = data["is_member_discount"].GetString();
-            m_member_discount = data["member_discount"].GetString();
-            m_discount = data["discount"].GetFloat();
-            m_coupon = data["coupon"].GetFloat();
-            m_delivery = data["delivery"].GetFloat();
-            m_price = data["price"].GetFloat();
-            m_order_date = data["order_date"].GetString();
-            m_order_fields = data["order_fields"].GetString();
-            m_order_status = data["order_status"].GetString();
-            m_courier_id = data["courier_id"].GetString();
-            m_is_selftake = data["is_selftake"].GetString();
-            //m_addservice_text = data["addservice_text"].GetString();
-            m_is_dabao = data["is_dabao"].GetString();
-            m_dabao_money = data["dabao_money"].GetString();
-            m_phone_customer_id = data["phone_customer_id"].GetString();
-            m_order_num = data["order_num"].GetString();
-            m_from_type = data["from_type"].GetString();
-            m_is_refund = data["is_refund"].GetString();
-            m_refund_status = data["refund_status"].GetString();
-            m_is_pickup = data["is_pickup"].GetString();
-            m_pickup_time = data["pickup_time"].GetString();
-            m_verify_time = data["verify_time"].GetString();
-            m_verify_user = data["verify_user"].GetString();
-            m_refund_failed_reason = data["refund_failed_reason"].GetString();
-            m_refund_time = data["refund_time"].GetString();
-            m_failed_reason = data["failed_reason"].GetString();
-            m_configmemo = data["configmemo"].GetString();
-            m_courier_type = data["courier_type"].GetString();
-            m_courier_name = data["courier_name"].GetString();
-            m_courier_phone = data["courier_phone"].GetString();
-            m_receiver_lng = data["receiver_lng"].GetString();
-            m_receiver_lat = data["receiver_lat"].GetString();
-            m_reduction_value = data["reduction_value"].GetString();
-            m_price_moling = data["price_moling"].GetString();
-            m_price_plus = data["price_plus"].GetString();
-            m_discount_price = data["discount_price"].GetString();
-            m_order_no = data["order_no"].GetString();
-            m_is_firstcut = data["is_firstcut"].GetString();
-            m_firstcut_value = data["firstcut_value"].GetString();
-            m_goods_coupon_value = data["goods_coupon_value"].GetString();
-            m_take_food_code = data["take_food_code"].GetString();
-            m_need_to_refund = data["need_to_refund"].GetString();
-
-            m_is_nowprinter = data["is_nowprinter"].GetInt();
-
-            m_shop_name = data["shop_name"].GetString();
-            m_longitude = data["longitude"].GetString();
-            m_latitude = data["latitude"].GetString();
-            m_open_selftake = data["open_selftake"].GetString();
-            m_invitetimetimerange = data["invitetimetimerange"].GetString();
-            m_machine_qrcode_open = data["machine_qrcode_open"].GetString();
-            m_machine_qrcode_url = data["machine_qrcode_url"].GetString();
-            m_machine_qrcode_title = data["machine_qrcode_title"].GetString();
-            m_delivery_date = data["delivery_date"].GetString();
-            m_head_picture = data["head_picture"].GetString();
-            m_courier = data["courier"].GetString();
-            m_delivertime = data["delivertime"].GetString();
-            m_customer_order_total = data["customer_order_total"].GetString();
-
-            m_invoice = data["invoice"].GetInt();
-
-            m_invoice_type = data["invoice_type"].GetString();
-            m_tax_payer_id = data["tax_payer_id"].GetString();
-
-            //开始保存订单详情
-            rapidjson::Value& v_rows = data["order_item"];
-
-            for(rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
-            {
-                rapidjson::Value& v_row_i = v_rows[i];
-
-                CWaimaiOrderItem newItem;
-                newItem.m_id = v_row_i["id"].GetString();
-                newItem.m_food_name = v_row_i["food_name"].GetString();
-                newItem.m_item_price = v_row_i["item_price"].GetString();
-                newItem.m_quantity = v_row_i["quantity"].GetString();
-                newItem.m_type_id = v_row_i["type_id"].GetString();
-                newItem.m_foodpackage_id = v_row_i["foodpackage_id"].GetString();
-                newItem.m_is_foodpackage = v_row_i["is_foodpackage"].GetString();
-                newItem.m_food_unit = v_row_i["food_unit"].GetString();
-                newItem.m_order_item_id = v_row_i["order_item_id"].GetString();
-                newItem.m_food_id = v_row_i["food_id"].GetString();
-                newItem.m_barcode = v_row_i["barcode"].GetString();
-
-                m_order_items.push_back(newItem);
-            }
-
-            //开始保存预设选项
-            v_rows = data["order_field"];
-
-            for(rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
-            {
-                rapidjson::Value& v_row_i = v_rows[i];
-
-                CWaimaiOrderField newItem;
-                newItem.name = v_row_i["name"].GetString();
-                newItem.value = v_row_i["value"].GetString();
-
-                m_order_field.push_back(newItem);
-            }
-
-            //开始保存增值服务费
-            v_rows = data["addservice"];
-
-            for(rapidjson::SizeType i = 0; i < v_rows.Size(); ++i)
-            {
-                rapidjson::Value& v_row_i = v_rows[i];
-
-                CWaimaiOrderField newItem;
-                newItem.name = v_row_i["name"].GetString();
-                newItem.value = v_row_i["value"].GetString();
-
-                m_addservie.push_back(newItem);
-            }
-        }
-    }
-
-    return true;
-}
-
-bool CWaimaiOrder::ConfirmeOrder(std::string order_id)
-{
-    std::string url = "/waimaiorder/orderconfirm";
-
-    //请求外卖的未处理订单
-    std::map<string, string> params;
-    params["id"] = order_id;
-    std::string response;
-
-    CZhipuziHttpClient::Request(url.c_str(), params, response);
-
-    rapidjson::Document document;
-    document.Parse(response.c_str());
-
-    if(document.HasParseError())
-    {
-        LOG_INFO("parse response error!");
-        return false;
-    }
-
-    if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-    {
-        LOG_INFO("json error!");
-        return false;
-    }
-
-    rapidjson::Value& v_errcode = document["errcode"];
-    int errcode = v_errcode.GetInt();
-    if(errcode != 0)
-    {
-        LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-        return false;
-    }
-
-    //获得数据成功
-    rapidjson::Value& data = document["data"];
-    rapidjson::Value& v_count = data["count"];
-    string count = v_count.GetString();
-
-    return true;
-}
-
-bool CWaimaiOrder::SuccessOrder(std::string order_id)
-{
-    std::string url = "/waimaiorder/ordersucceeded";
-
-    //请求外卖的未处理订单
-    std::map<string, string> params;
-    params["id"] = order_id;
-    std::string response;
-
-    CZhipuziHttpClient::Request(url.c_str(), params, response);
-
-    rapidjson::Document document;
-    document.Parse(response.c_str());
-
-    if(document.HasParseError())
-    {
-        LOG_INFO("parse response error!");
-        return false;
-    }
-
-    if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-    {
-        LOG_INFO("json error!");
-        return false;
-    }
-
-    rapidjson::Value& v_errcode = document["errcode"];
-    int errcode = v_errcode.GetInt();
-    if(errcode != 0)
-    {
-        LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-        return false;
-    }
-
-    //获得数据成功
-    rapidjson::Value& data = document["data"];
-    rapidjson::Value& v_count = data["count"];
-    string count = v_count.GetString();
-
-    return true;
-}
-
-bool CWaimaiOrder::FailOrder(std::string order_id, std::string reason)
-{
-    std::string url = "/waimaiorder/orderfail";
-
-    //请求外卖的未处理订单
-    std::map<string, string> params;
-    params["id"] = order_id;
-    params["failed_reason"] = reason;
-    std::string response;
-
-    CZhipuziHttpClient::Request(url.c_str(), params, response);
-
-    rapidjson::Document document;
-    document.Parse(response.c_str());
-
-    if(document.HasParseError())
-    {
-        LOG_INFO("parse response error!");
-        return false;
-    }
-
-    if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-    {
-        LOG_INFO("json error!");
-        return false;
-    }
-
-    rapidjson::Value& v_errcode = document["errcode"];
-    int errcode = v_errcode.GetInt();
-    if(errcode != 0)
-    {
-        LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-        return false;
-    }
-
-    //获得数据成功
-    rapidjson::Value& data = document["data"];
-    rapidjson::Value& v_count = data["count"];
-    string count = v_count.GetString();
-
-    return true;
-}
-
-bool CWaimaiOrder::AgreeRefund(std::string order_id)
-{
-    std::string url = "/waimaiorder/agreerefund";
-
-    //请求外卖的未处理订单
-    std::map<string, string> params;
-    params["order_id"] = order_id;
-    std::string response;
-
-    CZhipuziHttpClient::Request(url.c_str(), params, response);
-
-    rapidjson::Document document;
-    document.Parse(response.c_str());
-
-    if(document.HasParseError())
-    {
-        LOG_INFO("parse response error!");
-        return false;
-    }
-
-    if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-    {
-        LOG_INFO("json error!");
-        return false;
-    }
-
-    rapidjson::Value& v_errcode = document["errcode"];
-    int errcode = v_errcode.GetInt();
-    if(errcode != 0)
-    {
-        LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-        return false;
-    }
-
-    //获得数据成功
-    rapidjson::Value& data = document["data"];
-    rapidjson::Value& v_count = data["count"];
-    string count = v_count.GetString();
-
-    return true;
-}
-
-bool CWaimaiOrder::DisagreeRefund(std::string order_id)
-{
-    std::string url = "/waimaiorder/disagreerefund";
-
-    //请求外卖的未处理订单
-    std::map<string, string> params;
-    params["order_id"] = order_id;
-    std::string response;
-
-    CZhipuziHttpClient::Request(url.c_str(), params, response);
-
-    rapidjson::Document document;
-    document.Parse(response.c_str());
-
-    if(document.HasParseError())
-    {
-        LOG_INFO("parse response error!");
-        return false;
-    }
-
-    if(!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
-    {
-        LOG_INFO("json error!");
-        return false;
-    }
-
-    rapidjson::Value& v_errcode = document["errcode"];
-    int errcode = v_errcode.GetInt();
-    if(errcode != 0)
-    {
-        LOG_INFO("response failed! message:" << document["errmsg"].GetString());
-        return false;
-    }
-
-    //获得数据成功
-    rapidjson::Value& data = document["data"];
-    rapidjson::Value& v_count = data["count"];
-    string count = v_count.GetString();
-
-    return true;
-}

+ 0 - 125
zhipuzi_pay_plugin/order/CWaimaiOrder.h

@@ -1,125 +0,0 @@
-#pragma once
-
-#include <string>
-#include <vector>
-
-class CWaimaiOrderItem
-{
-public:
-    std::string m_id;
-    std::string m_food_name;
-    std::string m_item_price;
-    std::string m_quantity;
-    std::string m_type_id;
-    std::string m_foodpackage_id;
-    std::string m_is_foodpackage;
-    std::string m_food_unit;
-    std::string m_order_item_id;
-    std::string m_food_id;
-    std::string m_barcode;
-};
-
-class CWaimaiOrderField
-{
-public:
-    std::string name;
-    std::string value;
-};
-
-class CWaimaiOrder
-{
-public:
-    CWaimaiOrder();
-    ~CWaimaiOrder();
-
-    bool InitData(std::string order_id, std::string order_no);
-
-    bool ConfirmeOrder(std::string order_id);
-    bool SuccessOrder(std::string order_id);
-    bool FailOrder(std::string order_id, std::string reason);
-
-    bool AgreeRefund(std::string order_id);
-    bool DisagreeRefund(std::string order_id);
-
-public:
-    std::string m_order_id;
-    std::string m_shop_id;
-    std::string m_restaurant_number;
-    std::string m_customer_id;
-    std::string m_customer_name;
-    std::string m_phone;
-    std::string m_address;
-    std::string m_memo;
-    std::string m_pay_type;
-    std::string m_promotion;
-    std::string m_is_member_discount;
-    std::string m_member_discount;
-
-    double m_discount;
-    double m_coupon;
-    double m_delivery;
-    double m_price;
-
-    std::string m_order_date;
-    std::string m_order_fields;
-    std::string m_order_status;
-    std::string m_courier_id;
-    std::string m_is_selftake;
-    std::string m_addservice_text;
-    std::string m_is_dabao;
-    std::string m_dabao_money;
-    std::string m_phone_customer_id;
-    std::string m_order_num;
-    std::string m_from_type;
-    std::string m_is_refund;
-    std::string m_refund_status;
-    std::string m_is_pickup;
-    std::string m_pickup_time;
-    std::string m_verify_time;
-    std::string m_verify_user;
-    std::string m_refund_failed_reason;
-    std::string m_refund_time;
-    std::string m_failed_reason;
-    std::string m_configmemo;
-    std::string m_courier_type;
-    std::string m_courier_name;
-    std::string m_courier_phone;
-    std::string m_receiver_lng;
-    std::string m_receiver_lat;
-    std::string m_reduction_value;
-    std::string m_price_moling;
-    std::string m_price_plus;
-    std::string m_discount_price;
-    std::string m_order_no;
-    std::string m_is_firstcut;
-    std::string m_firstcut_value;
-    std::string m_goods_coupon_value;
-    std::string m_take_food_code;
-    std::string m_need_to_refund;
-
-    int m_is_nowprinter;
-
-    std::string m_shop_name;
-    std::string m_longitude;
-    std::string m_latitude;
-    std::string m_open_selftake;
-    std::string m_invitetimetimerange;
-    std::string m_machine_qrcode_open;
-    std::string m_machine_qrcode_url;
-    std::string m_machine_qrcode_title;
-    std::string m_delivery_date;
-    std::string m_head_picture;
-    std::string m_courier;
-    std::string m_delivertime;
-    std::string m_customer_order_total;
-
-    int m_invoice;
-
-    std::string m_invoice_type;
-    std::string m_tax_payer_id;
-
-    std::vector<CWaimaiOrderItem> m_order_items;
-    std::vector<CWaimaiOrderField> m_order_field;
-    std::vector<CWaimaiOrderField> m_addservie;
-};
-

+ 68 - 63
zhipuzi_pay_plugin/tool/CPosPrinter.cpp

@@ -423,89 +423,84 @@ int CPosPrinter::GetPrinterType(wstring vid, wstring pid)
 }
 
 /*
- *打印收银小票
+ *打印一张测试小票
  **/
-void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
+void CPosPrinter::PrintTest()
 {
-    //设置模式,后面输出数据不会错
-    m_type = 1;
+	//设置模式,后面输出数据不会错
+	m_type = 1;
 
-    std::string printer_leixing = CSetting::GetParam("setting_printer_leixing");
+	std::string printer_leixing = CSetting::GetParam("system_setting_dayinji_setting_type");
 
-    if(printer_leixing == "auto")
-    {
-        InitShouyin();
-    }
-    else if(printer_leixing == "usb")
-    {
-        std::string printer_usb = CSetting::GetParam("setting_printer_usb");
-        std::wstring ws_printer_usb = CLewaimaiString::UTF8ToUnicode(printer_usb);
+	if (printer_leixing == "1")
+	{
+		//usb模式
+		std::string printer_usb = CSetting::GetParam("system_setting_dayinji_usb_port");
+		std::wstring ws_printer_usb = CLewaimaiString::UTF8ToUnicode(printer_usb);
 
-        bool ret = InitOneUsb(ws_printer_usb);
+		bool ret = InitOneUsb(ws_printer_usb);
 		if (ret == false)
 		{
 			return;
 		}
-    }
-    else if(printer_leixing == "bingkou")
-    {
-        bool ret = InitBingkou();
+	}
+	else if (printer_leixing == "2")
+	{
+		//串口
+		InitCom();
+	}
+	else if (printer_leixing == "3")
+	{
+		//并口
+		bool ret = InitBingkou();
 		if (ret == false)
 		{
 			return;
 		}
-    }
-    else if(printer_leixing == "chuankou")
-    {
-        InitCom();
-    }
-    else if(printer_leixing == "wangkou")
-    {
-        m_type = 2;
-
-        std::string wangkou_ip = CSetting::GetParam("setting_printer_wangkou_ip");
+	}
+	else if (printer_leixing == "4")
+	{
+		//网口
+		m_type = 2;
 
-        //初始化连接
-        try
-        {
-            boost::asio::ip::tcp::endpoint ep(boost::asio::ip::address::from_string(wangkou_ip.c_str()), 9100);
-            m_socket.connect(ep);
-        }
-        catch(std::exception& e)
-        {
-            std::string err = e.what();
-            LOG_INFO("网口打印机连接失败,IP地址:" << wangkou_ip.c_str() << ",错误信息:" << err.c_str());
-        }
-    }
+		std::string wangkou_ip = CSetting::GetParam("system_setting_dayinji_wangkou_ip");
 
-    //读取当前收银打印机的设置
-    std::string guige = CSetting::GetParam("setting_printer_guige");
-    std::string lianshu = CSetting::GetParam("setting_printer_lianshu");
-    int n_lianshu = atoi(lianshu.c_str());
+		//初始化连接
+		try
+		{
+			boost::asio::ip::tcp::endpoint ep(boost::asio::ip::address::from_string(wangkou_ip.c_str()), 9100);
+			m_socket.connect(ep);
+		}
+		catch (std::exception& e)
+		{
+			std::string err = e.what();
+			LOG_INFO("网口打印机连接失败,IP地址:" << wangkou_ip.c_str() << ",错误信息:" << err.c_str());
+		}
+	}
 
-    //正式开始打印
-    for(int i = 0; i < n_lianshu; i++)
-    {
-        POS_Reset();
+	//正式开始打印
+	for (int i = 0; i < 1; i++)
+	{
+		POS_Reset();
 
-        //走纸几行再切
-        POS_FeedLine();
-        POS_FeedLine();
-        POS_FeedLine();
-        POS_FeedLine();
-        POS_FeedLine();
+		//走纸几行再切
+		POS_FeedLine();
+		POS_FeedLine();
+		POS_FeedLine();
+		POS_FeedLine();
+		POS_FeedLine();
 
-        POS_CutPaper();
-    }
+		POS_CutPaper();
+	}
 
-    //还原打印机初始设置,有些傻逼收银设备居然不是自动调用,比如哗啦啦
-    POS_Reset();
+	//还原打印机初始设置,有些傻逼收银设备居然不是自动调用,比如哗啦啦
+	POS_Reset();
 
-    //关闭设备
-    for(std::vector<PrinterHandle>::iterator it = m_hPorts.begin(); it != m_hPorts.end(); it++)
-    {
-        CloseHandle((*it).hPort);
-    }
+	//关闭设备
+	for (std::vector<PrinterHandle>::iterator it = m_hPorts.begin(); it != m_hPorts.end(); it++)
+	{
+		CloseHandle((*it).hPort);
+	}
 
 	if (m_type == 2)
 	{
@@ -513,6 +508,16 @@ void CPosPrinter::PrintWaimaiOrderShouyin(CWaimaiOrder& order)
 	}
 }
 
+void CPosPrinter::PrintZhifu(CShouyinOrder& order)
+{
+
+}
+
+void CPosPrinter::PrintTuikuan(CShouyinOrder& order)
+{
+
+}
+
 std::vector<std::wstring> CPosPrinter::getUsbDevices()
 {
     return m_usb_devices;

+ 4 - 2
zhipuzi_pay_plugin/tool/CPosPrinter.h

@@ -1,7 +1,7 @@
 #pragma once
 
 #include "../pch/pch.h"
-#include "../order/CWaimaiOrder.h"
+#include "../order/CShouyinOrder.h"
 
 //SetupDiGetInterfaceDeviceDetail所需要的输出长度,定义足够大
 #define INTERFACE_DETAIL_SIZE 1024
@@ -26,7 +26,9 @@ public:
     CPosPrinter();
     ~CPosPrinter();
 
-    void PrintWaimaiOrderShouyin(CWaimaiOrder& order);
+	void PrintTest();
+	void PrintZhifu(CShouyinOrder& order);
+	void PrintTuikuan(CShouyinOrder& order);
 
 	//usb打印机的类型 1:收银小票打印机 2:标签打印机
 	void InitUsb(int usbType = 1);

+ 18 - 0
zhipuzi_pay_plugin/tool/CSetting.cpp

@@ -189,6 +189,24 @@ void CSetting::Init()
 		m_paramsMap[system_setting_dayinji_setting_type] = "1";
 	}
 
+	std::string system_setting_dayinji_setting_auto_print = "system_setting_dayinji_setting_auto_print";
+	if (m_paramsMap.find(system_setting_dayinji_setting_auto_print) == m_paramsMap.end())
+	{
+		m_paramsMap[system_setting_dayinji_setting_auto_print] = "1";
+	}
+
+	std::string system_setting_dayinji_setting_num = "system_setting_dayinji_setting_num";
+	if (m_paramsMap.find(system_setting_dayinji_setting_num) == m_paramsMap.end())
+	{
+		m_paramsMap[system_setting_dayinji_setting_num] = "1";
+	}
+
+	std::string system_setting_dayinji_setting_konghang = "system_setting_dayinji_setting_konghang";
+	if (m_paramsMap.find(system_setting_dayinji_setting_konghang) == m_paramsMap.end())
+	{
+		m_paramsMap[system_setting_dayinji_setting_konghang] = "3";
+	}
+
 	std::string system_setting_dayinji_usb_port = "system_setting_dayinji_usb_port";
 	if (m_paramsMap.find(system_setting_dayinji_usb_port) == m_paramsMap.end())
 	{

+ 9 - 0
zhipuzi_pay_plugin/wnd/CShoukuanWnd.cpp

@@ -388,6 +388,13 @@ LRESULT CShoukuanWnd::OnShoukuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lP
 
 LRESULT CShoukuanWnd::OnShoukuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
+	//判断是否要打印
+	int dayinji_setting_auto_print = atoi(CSetting::GetParam("system_setting_dayinji_setting_auto_print").c_str());
+	if (dayinji_setting_auto_print == 1)
+	{
+		m_valueWnd->PrintZhifu(m_out_trade_no);
+	}
+
 	wstring path = CSystem::GetProgramDir() + L"\\music\\pay_success.wav";
 	PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
 
@@ -622,6 +629,8 @@ void CShoukuanWnd::HandleShoukuan()
 		//支付成功
 		m_shoukuan_status = 3;
 
+		m_out_trade_no = data["out_trade_no"].GetString();
+
 		SendMessage(WM_SHOUKUAN_STATUS_SUCCESS, 0, 0);
 	}
 	else if (s_status == "fail")

+ 9 - 0
zhipuzi_pay_plugin/wnd/CShoukuanWnd.h

@@ -2,6 +2,8 @@
 
 #include "../pch/pch.h"
 
+class CValueWnd;
+
 class CShoukuanWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
 {
 public:
@@ -26,6 +28,11 @@ public:
 		delete this;
 	};
 
+	void setValueWnd(CValueWnd* valueWnd)
+	{
+		m_valueWnd = valueWnd;
+	}
+
 	void Init();
 
 	void Notify(TNotifyUI& msg);
@@ -84,6 +91,8 @@ public:
 public:
 	CPaintManagerUI m_pm;
 
+	CValueWnd* m_valueWnd;
+
 	bool m_is_money_init = false;
 	std::wstring m_money;
 

+ 79 - 0
zhipuzi_pay_plugin/wnd/CSystemSettingWnd.cpp

@@ -271,6 +271,31 @@ void CSystemSettingWnd::Init()
         dayinji_wangkou_layout->SetVisible(true);
     }
 
+    //是否自动打印
+    CCheckBoxUI* pAutoPrint = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("dayinji_setting_auto_print")));
+
+    int dayinji_setting_auto_print = atoi(CSetting::GetParam("system_setting_dayinji_setting_auto_print").c_str());
+    if(dayinji_setting_auto_print == 1)
+    {
+        pAutoPrint->SetCheck(true, false);
+    }
+    else
+    {
+        pAutoPrint->SetCheck(false, false);
+    }
+
+    //打印份数
+    std::string dayinji_setting_num = CSetting::GetParam("system_setting_dayinji_setting_num").c_str();
+
+    CEditUI* pDayinNum = static_cast<CEditUI*>(m_pm.FindControl(_T("dayinji_setting_print_num")));
+    pDayinNum->SetText(CLewaimaiString::UTF8ToUnicode(dayinji_setting_num).c_str());
+
+    //空的行数
+    std::string dayinji_setting_konghang = CSetting::GetParam("system_setting_dayinji_setting_konghang").c_str();
+
+    CEditUI* pDayinKonghang = static_cast<CEditUI*>(m_pm.FindControl(_T("dayinji_setting_konghang")));
+    pDayinKonghang->SetText(CLewaimaiString::UTF8ToUnicode(dayinji_setting_konghang).c_str());
+
     //usb打印机下拉框默认选中
     CComboUI* com_usb = static_cast<CComboUI*>(m_pm.FindControl(_T("dayinji_setting_usb_port")));
     com_usb->RemoveAll();
@@ -694,9 +719,59 @@ void CSystemSettingWnd::HandleClickMsg(TNotifyUI& msg)
     }
     else if(senderName == _T("dayinji_setting_save"))
     {
+        //先判断填的内容有没问题
+        //打印份数
+        CEditUI* pDayinNum = static_cast<CEditUI*>(m_pm.FindControl(_T("dayinji_setting_print_num")));
+        std::wstring wsDayinNum = pDayinNum->GetText();
+        std::string sDayinNum = CLewaimaiString::UnicodeToUTF8(wsDayinNum);
+
+        //空的行数
+        CEditUI* pDayinKonghang = static_cast<CEditUI*>(m_pm.FindControl(_T("dayinji_setting_konghang")));
+        std::wstring wsDayinKonghang = pDayinKonghang->GetText();
+        std::string sDayinKonghang = CLewaimaiString::UnicodeToUTF8(wsDayinKonghang);
+
+        if(atoi(sDayinNum.c_str()) == 0)
+        {
+            MessageBox(GetHWND(), L"打印联数设置错误,最少1联", L"提示", MB_OK);
+            return;
+        }
+        if(atoi(sDayinNum.c_str()) > 4)
+        {
+            MessageBox(GetHWND(), L"打印联数设置错误,最多4联", L"提示", MB_OK);
+            return;
+        }
+
+        if(atoi(sDayinKonghang.c_str()) == 0)
+        {
+            MessageBox(GetHWND(), L"空行数量不对,最少1行", L"提示", MB_OK);
+            return;
+        }
+        if(atoi(sDayinKonghang.c_str()) > 20)
+        {
+            MessageBox(GetHWND(), L"空行数量不对,最多20行", L"提示", MB_OK);
+            return;
+        }
+
         //首先保存截取模式
         CSetting::SetParam("system_setting_dayinji_setting_type", to_string(m_nDayinType).c_str(), true);
 
+        //保存是否自动打印
+        CCheckBoxUI* pAutoPrint = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("dayinji_setting_auto_print")));
+        bool is_auto_print = pAutoPrint->GetCheck();
+        if(is_auto_print)
+        {
+            CSetting::SetParam("system_setting_dayinji_setting_auto_print", "1", true);
+        }
+        else
+        {
+            CSetting::SetParam("system_setting_dayinji_setting_auto_print", "0", true);
+        }
+
+        //保存打印联数和行数
+        CSetting::SetParam("system_setting_dayinji_setting_num", sDayinNum, true);
+
+        CSetting::SetParam("system_setting_dayinji_setting_konghang", sDayinKonghang, true);
+
         if(m_nDayinType == 1)
         {
             //保存USB参数
@@ -721,6 +796,10 @@ void CSystemSettingWnd::HandleClickMsg(TNotifyUI& msg)
             CSetting::SetParam("system_setting_dayinji_wangkou_ip", CLewaimaiString::UnicodeToUTF8(ws_ip));
         }
     }
+    else if(senderName == _T("dayinji_print_test"))
+    {
+        m_valueWnd->PrintTest();
+    }
     else if(senderName == _T("kuaijiejian_setting_jiesuan_btn"))
     {
         m_kuaijiejian_type = 1;

+ 9 - 0
zhipuzi_pay_plugin/wnd/CTuikuanWnd.cpp

@@ -376,6 +376,13 @@ LRESULT CTuikuanWnd::OnTuikuanNeedPassword(UINT uMsg, WPARAM wParam, LPARAM lPar
 
 LRESULT CTuikuanWnd::OnTuikuanSuccess(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
+	//判断是否要打印
+	int dayinji_setting_auto_print = atoi(CSetting::GetParam("system_setting_dayinji_setting_auto_print").c_str());
+	if (dayinji_setting_auto_print == 1)
+	{
+		m_valueWnd->PrintTuikuan(m_out_trade_no);
+	}
+
 	wstring path = CSystem::GetProgramDir() + L"\\music\\refund_success.wav";
 	PlaySound(path.c_str(), NULL, SND_FILENAME | SND_ASYNC);
 
@@ -568,6 +575,8 @@ void CTuikuanWnd::HandleTuikuan()
 		//退款成功
 		m_tuikuan_status = 3;
 
+		m_out_trade_no = data["out_trade_no"].GetString();
+
 		SendMessage(WM_TUIKUAN_STATUS_SUCCESS, 0, 0);
 	}
 	else if (s_status == "fail")

+ 9 - 0
zhipuzi_pay_plugin/wnd/CTuikuanWnd.h

@@ -2,6 +2,8 @@
 
 #include "../pch/pch.h"
 
+class CValueWnd;
+
 class CTuikuanWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
 {
 public:
@@ -26,6 +28,11 @@ public:
 		delete this;
 	};
 
+	void setValueWnd(CValueWnd* valueWnd)
+	{
+		m_valueWnd = valueWnd;
+	}
+
 	void Init();
 
 	void Notify(TNotifyUI& msg);
@@ -76,6 +83,8 @@ public:
 public:
 	CPaintManagerUI m_pm;
 
+	CValueWnd* m_valueWnd;
+
 	bool m_is_money_init = false;
 	std::wstring m_money;
 

+ 26 - 0
zhipuzi_pay_plugin/wnd/CValueWnd.cpp

@@ -7,6 +7,8 @@
 
 #include "../helper/CBitmapHelper.h"
 
+#include "../network/CMessagePush.h"
+
 #include <atltypes.h>
 
 void CValueWnd::Notify(TNotifyUI& msg)
@@ -35,6 +37,10 @@ void CValueWnd::Init()
     //添加托盘图标
     AddTrayIcon();
 
+	//登录成功,启动消息和任务处理
+	m_push = new CMessagePush(m_hWnd);
+	m_push->Start();
+
     //初始化菜单窗口
     pMenu = new CMenuWnd(this);
     pMenu->Create(NULL, L"智铺子收银插件菜单", WS_POPUP, WS_EX_TOOLWINDOW);
@@ -370,6 +376,9 @@ LRESULT CValueWnd::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan
 
 	UnregisterHotKey(m_hWnd, WM_MYHOTKEY_SHOUKUAN);
 
+	//注意这里不能delete,这个对象会delete自己
+	m_push->Stop();
+
     bHandled = FALSE;
     return 0;
 }
@@ -575,6 +584,8 @@ void CValueWnd::ShowShoukuan()
 	CShoukuanWnd* pShoukuanWnd = new CShoukuanWnd;
 	if (pShoukuanWnd != NULL)
 	{
+		pShoukuanWnd->setValueWnd(this);
+
 		pShoukuanWnd->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
 		pShoukuanWnd->SetIcon(IDI_ICON_DUILIB);
 		pShoukuanWnd->CenterWindow();
@@ -1145,4 +1156,19 @@ bool CValueWnd::UpdateRegisterHotKey()
 	int nRet = RegisterHotKey(m_hWnd, WM_MYHOTKEY_SHOUKUAN, shoukuan_mod, shoukuan_vk);
 
 	return nRet;
+}
+
+void CValueWnd::PrintTest()
+{
+	m_push->AddPinter("", 3);
+}
+
+void CValueWnd::PrintZhifu(std::string out_trade_no)
+{
+
+}
+
+void CValueWnd::PrintTuikuan(std::string out_trade_no)
+{
+
 }

+ 10 - 0
zhipuzi_pay_plugin/wnd/CValueWnd.h

@@ -13,6 +13,8 @@
 #include "CShoukuanWnd.h"
 #include "CTuikuanWnd.h"
 
+class CMessagePush;
+
 class CValueWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
 {
 public:
@@ -112,6 +114,12 @@ public:
 	tesseract::TessBaseAPI& GetTess();
 
 	bool UpdateRegisterHotKey();
+	
+	//打印测试小票
+	void PrintTest();
+
+	void PrintZhifu(std::string out_trade_no);
+	void PrintTuikuan(std::string out_trade_no);
 private:
 	void UpdateKexian(const char* data, int length);
 
@@ -125,6 +133,8 @@ private:
 	//定义托盘图标对象
 	NOTIFYICONDATA m_trayIcon;
 
+	CMessagePush* m_push = NULL;
+
 	//菜单窗口
 	CMenuWnd* pMenu;
 

+ 2 - 9
zhipuzi_pay_plugin/zhipuzi_pay_plugin.vcxproj

@@ -243,15 +243,12 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="wnd\CMessageboxWnd.h" />
     <ClInclude Include="wnd\CUpdateWnd.h" />
     <ClInclude Include="wnd\CWaimaiOrderFailReasonWnd.h" />
-    <ClInclude Include="network\PosMessage.h" />
-    <ClInclude Include="control\CWaimaiOrderInfoUI.h" />
     <ClInclude Include="control\CSettingUI.h" />
     <ClInclude Include="tool\CSetting.h" />
     <ClInclude Include="tool\CSqlite3.h" />
     <ClInclude Include="network\CMessagePush.h" />
-    <ClInclude Include="order\CWaimaiOrder.h" />
+    <ClInclude Include="order\CShouyinOrder.h" />
     <ClInclude Include="tool\CPosPrinter.h" />
-    <ClInclude Include="control\CWaimaiOrderItemUI.h" />
     <ClInclude Include="wnd\CLoginWnd.h" />
     <ClInclude Include="helper\MD5.h" />
     <ClInclude Include="network\CZhipuziHttpClient.h" />
@@ -265,7 +262,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="pch\pch.h" />
     <ClInclude Include="tool\CLewaimaiTime.h" />
     <ClInclude Include="helper\CSystem.h" />
-    <ClInclude Include="control\OrderListUI.h" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="wnd\CJiaoyihuizongWnd.cpp" />
@@ -288,14 +284,12 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="wnd\CMessageboxWnd.cpp" />
     <ClCompile Include="wnd\CUpdateWnd.cpp" />
     <ClCompile Include="wnd\CWaimaiOrderFailReasonWnd.cpp" />
-    <ClCompile Include="control\CWaimaiOrderInfoUI.cpp" />
     <ClCompile Include="control\CSettingUI.cpp" />
     <ClCompile Include="tool\CSetting.cpp" />
     <ClCompile Include="tool\CSqlite3.cpp" />
     <ClCompile Include="network\CMessagePush.cpp" />
-    <ClCompile Include="order\CWaimaiOrder.cpp" />
+    <ClCompile Include="order\CShouyinOrder.cpp" />
     <ClCompile Include="tool\CPosPrinter.cpp" />
-    <ClCompile Include="control\CWaimaiOrderItemUI.cpp" />
     <ClCompile Include="wnd\CLoginWnd.cpp" />
     <ClCompile Include="helper\MD5.cpp" />
     <ClCompile Include="network\CZhipuziHttpClient.cpp" />
@@ -307,7 +301,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="zhipuzi_pay_plugin.cpp" />
     <ClCompile Include="pch\pch.cpp" />
     <ClCompile Include="tool\CLewaimaiTime.cpp" />
-    <ClCompile Include="control\OrderListUI.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="resource\zhipuzi_pay_plugin.rc" />

+ 6 - 27
zhipuzi_pay_plugin/zhipuzi_pay_plugin.vcxproj.filters

@@ -54,24 +54,12 @@
     <ClInclude Include="tool\CPosPrinter.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="order\CWaimaiOrder.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="network\CMessagePush.h">
       <Filter>头文件</Filter>
     </ClInclude>
     <ClInclude Include="control\ControlEx.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="control\CWaimaiOrderInfoUI.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="control\CWaimaiOrderItemUI.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
-    <ClInclude Include="control\OrderListUI.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="control\CSettingUI.h">
       <Filter>头文件</Filter>
     </ClInclude>
@@ -81,9 +69,6 @@
     <ClInclude Include="tool\CSetting.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="network\PosMessage.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="wnd\CWaimaiOrderFailReasonWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
@@ -144,6 +129,9 @@
     <ClInclude Include="wnd\CJiaoyihuizongWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
+    <ClInclude Include="order\CShouyinOrder.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="pch\pch.cpp">
@@ -179,24 +167,12 @@
     <ClCompile Include="tool\CPosPrinter.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="order\CWaimaiOrder.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
     <ClCompile Include="network\CMessagePush.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
     <ClCompile Include="zhipuzi_pay_plugin.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="control\CWaimaiOrderInfoUI.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="control\OrderListUI.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="control\CWaimaiOrderItemUI.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
     <ClCompile Include="control\CSettingUI.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
@@ -266,6 +242,9 @@
     <ClCompile Include="wnd\CJiaoyihuizongWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
+    <ClCompile Include="order\CShouyinOrder.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <Image Include="resource\zhipuzi.ico">