From 5c9991be21f57781573f04961ec511ac2938ea3d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 08 四月 2025 15:27:08 +0800
Subject: [PATCH] '功能完善'

---
 DelegateQueue/MainFrame.cpp |   62 +++++++++++++++++++++++++------
 1 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/DelegateQueue/MainFrame.cpp b/DelegateQueue/MainFrame.cpp
index 4509e89..2b2280b 100644
--- a/DelegateQueue/MainFrame.cpp
+++ b/DelegateQueue/MainFrame.cpp
@@ -95,7 +95,7 @@
 
 		delegateInfoStr.Append("/").Append("封单").Append(delegateInfo.buy1_money);
 
-		delegateInfoStr.Append(" 【比例: ");
+		delegateInfoStr.Append(" 【排: ");
 
 		ColorIndexInfo colorInfo2;
 		colorInfo2.start_index = delegateInfoStr.Length();
@@ -103,6 +103,20 @@
 		colorInfo2.end_index = delegateInfoStr.Length() - 1;
 		colorInfo2.color = wxColor(206, 14, 95);
 		delegateColors.push_back(colorInfo2);
+
+		delegateInfoStr.Append(",撤:");
+
+		ColorIndexInfo colorInfo22;
+		colorInfo22.start_index = delegateInfoStr.Length();
+		delegateInfoStr.Append(delegateInfo.l_down_cancel_rate);
+		colorInfo22.end_index = delegateInfoStr.Length() - 1;
+		colorInfo22.color = wxColor(0, 230, 0);
+		delegateColors.push_back(colorInfo22);
+
+		delegateInfoStr.Append(",期:");
+
+		delegateInfoStr.Append(delegateInfo.expire_rate);
+
 		delegateInfoStr.Append("】,");
 
 		delegateInfoStr.Append("已成大单").Append(to_string(delegateInfo.big_num_count)).Append("笔").Append(delegateInfo.big_num_money).Append("  ");
@@ -350,6 +364,11 @@
 
 		// 绘制简介区
 		int infoWidth = cell.GetSize().GetWidth();
+
+		wxFont font = dc->GetFont();
+		font.SetPointSize(10);
+		dc->SetFont(font);
+
 		int infoHeight = WidgetsRenderUtil::drawText(dc, delegateInfoStr, wxPoint(start_x, start_y + 25 * DPI / 100), infoWidth, TEXT_LINE_HEIGHT, delegateColors);
 		// 绘制队列,给文字信息留3排左右的位置
 
@@ -444,6 +463,11 @@
 					SendMessage(hwnd, WM_USER + 1024, 0, reinterpret_cast<LPARAM>(&data));
 				}
 			}
+			else {
+				throw CString(L"没找到盘副屏窗口");
+			}
+		}
+		catch (CString msg) {
 		}
 		catch (...) {
 		}
@@ -702,14 +726,16 @@
 	list<DelegateInfo> fresults;
 	wxString available_money = "";
 	auto doc = JsonUtil::parseUTF16(result);
-	if (doc.IsObject() && doc[L"code"].GetInt() == 0) {
+	if (doc.IsObject() && doc[L"code"].GetInt() == 0&& doc.HasMember(L"data")&& doc[L"data"].HasMember(L"delegates")) {
 		auto root = doc[L"data"].GetObject();
 		auto delegates = root[L"delegates"].GetArray();
-		double money = root[L"account_available_money"].GetDouble();
+		double money = 0.0;
+		if (root.HasMember(L"account_available_money")) {
+			money = root[L"account_available_money"].GetDouble();
+		}
 		available_money = StringUtil::to_string(money);
 		for (int i = 0; i < delegates.Size(); i++) {
 			auto doc = delegates[i].GetObject();
-
 			auto array = doc[L"code_info"].GetArray();
 			DelegateInfo delegateInfo;
 			delegateInfo.index = i;
@@ -741,12 +767,26 @@
 				delegateInfo.limit_up_time = doc[L"limit_up_time"].GetString();
 			}
 
-			array = doc[L"trade_queue"].GetArray();
+			if (doc.HasMember(L"l_down_cancel_rate")) {
+				wxString st = StringUtil::to_string(doc[L"l_down_cancel_rate"].GetFloat() * 100);
+				st.Append(L"%");
+				delegateInfo.l_down_cancel_rate = st;
+			}
+
+			if (doc.HasMember(L"expire_rate")) {
+				wxString st = doc[L"expire_rate"].GetString();
+				delegateInfo.expire_rate = st;
+			}
+
+			
 			list<TradeQueue> queueList;
-			for (int j = 0; j < array.Size(); j++) {
-				int num = array[j].GetArray()[0].GetInt();
-				int type = array[j].GetArray()[1].GetInt();
-				queueList.push_back(TradeQueue({ to_string(num),type }));
+			if (doc.HasMember(L"trade_queue")) {
+				array = doc[L"trade_queue"].GetArray();
+				for (int j = 0; j < array.Size(); j++) {
+					int num = array[j].GetArray()[0].GetInt();
+					int type = array[j].GetArray()[1].GetInt();
+					queueList.push_back(TradeQueue({ to_string(num),type }));
+				}
 			}
 			delegateInfo.tradeQueueList = queueList;
 
@@ -815,10 +855,8 @@
 			//cout << "刷新UI耗时:" << TimeUtil::getNowTimeStamp() - start_time << endl;
 		}
 	}
-	catch (string st) {
-
+	catch (... ) {
 	}
-
 }
 
 void MainFrame::OnSelectionChanged(wxDataViewEvent& event)

--
Gitblit v1.8.0