From 9adb473067a993b4e0eacf3675baf14b29da3eca Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 22 七月 2022 18:44:24 +0800 Subject: [PATCH] '测试' --- app/JsonUtil.h | 61 ++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 1 deletions(-) diff --git a/app/JsonUtil.h b/app/JsonUtil.h index cf8b604..a8c126e 100644 --- a/app/JsonUtil.h +++ b/app/JsonUtil.h @@ -4,6 +4,8 @@ #include "json/json.h" #include <THSActionUtil.h> #include "LimitUpCapture.h" +#include "TradeSuccessCapture.h" +#include "IndustryCapture.h" class JsonUtil { @@ -80,7 +82,7 @@ } data["data"] = _data; Json::Value root; - root["type"] = 3; + root["type"] = 10; root["client"] = clientID; root["data"] = data; return toJsonStr(root); @@ -112,6 +114,63 @@ } + static std::string loadTradeSuccessData(list<TradeSuccessData> dataList) { + Json::Value root; + root["type"] = 3; + + + Json::Value data; + + std::list<TradeSuccessData>::iterator ele; + int index = 0; + for (ele = dataList.begin();ele != dataList.end();ele++) { + Json::Value item; + item["date"] = (*ele).date; + item["code"] = (*ele).code; + item["time"] = (*ele).time; + item["num"] = (*ele).num; + item["money"] = (*ele).money; + item["trade_num"] = (*ele).trade_num; + item["type"] = (*ele).type; + data[index++] = item; + } + + root["data"] = data; + + + return toJsonStr(root); + } + + static std::string loadIndustryData(list<list<IndustryData>> dataList) { + Json::Value root; + root["type"] = 4; + + + Json::Value data; + + std::list<list<IndustryData>>::iterator ele; + int index = 0; + for (ele = dataList.begin();ele != dataList.end();ele++) { + Json::Value item; + + int cindex = 0; + for (list<IndustryData >::iterator e = (*ele).begin();e != (*ele).end();e++) { + Json::Value item_c; + item_c["code"] = (*e).code; + item_c["zyltgb"] = (*e).zyltMoney; + item_c["zyltgb_unit"] = (*e).zyltMoneyUnit; + item[cindex++] = item_c; + } + data[index++] = item; + } + + root["data"] = data; + + + return toJsonStr(root); + } + + static std::string loadGPCodeData(std::list<string> codeList) { Json::Value root; root["type"] = 1; -- Gitblit v1.8.0