| | |
| | | if (kill) { |
| | | break; |
| | | } |
| | | dlg->taskUpdateTimeMap[REQUEST_TASK_L2_SUBSCRIPT] = TimeUtil::getNowTime(); |
| | | |
| | | try { |
| | | SubscriptCodesResult result = NetworkApi::get_huaxin_subscript_codes(); |
| | | if (result.codeInfos.size() > 0) { |
| | |
| | | } |
| | | |
| | | try { |
| | | dlg->taskUpdateTimeMap[REQUEST_TASK_ENV] = TimeUtil::getNowTime(); |
| | | |
| | | string result = NetworkApi::get_env_status(); |
| | | CString st = L""; |
| | |
| | | if (doc.IsObject()) { |
| | | if (doc[L"code"] == 0) { |
| | | auto data = doc[L"data"].GetObjectW(); |
| | | if (data[L"juejin"].GetInt() == 1) { |
| | | if (data.HasMember(L"juejin")&&data[L"juejin"].GetInt() == 1) { |
| | | dlg->labelColors[IDC_STATIC_JUEJIN_STATE] = RGB(0, 0, 0); |
| | | dlg->labelJueJinState.SetWindowTextW(L"正常"); |
| | | } |
| | |
| | | if (kill) { |
| | | break; |
| | | } |
| | | try { |
| | | string result = NetworkApi::list_system_log(dlg->logStartIndex, 20); |
| | | cout << result << endl; |
| | | rapidjson::GenericDocument<rapidjson::UTF16<>> doc = JsonUtil::parseUTF16(result); |
| | | if (dlg->checkAutoPullLogs.GetCheck()) { |
| | | try { |
| | | string result = NetworkApi::list_system_log(dlg->logStartIndex, 20); |
| | | cout << result << endl; |
| | | rapidjson::GenericDocument<rapidjson::UTF16<>> doc = JsonUtil::parseUTF16(result); |
| | | |
| | | if (doc.IsObject() && doc[L"code"].GetInt() == 0) { |
| | | list<TradeDealRecord> tempRecordList; |
| | | //解析结果 |
| | | auto dataList = doc[L"data"][L"list"].GetArray(); |
| | | if (dataList.Size() > 0) { |
| | | dlg->logStartIndex += dataList.Size(); |
| | | std::list<CString> tempList; |
| | | for (int i = 0; i < dataList.Size(); i++) { |
| | | auto item = dataList[i].GetArray(); |
| | | CString time = item[0].GetString(); |
| | | CString level = item[1].GetString(); |
| | | CString content = item[2].GetString(); |
| | | CString contentStr = L""; |
| | | contentStr.Append(time.Mid(11)); |
| | | contentStr.Append(L" - "); |
| | | contentStr.Append(L"["); |
| | | contentStr.Append(level); |
| | | contentStr.Append(L"] "); |
| | | contentStr.Append(content); |
| | | tempList.push_back(contentStr); |
| | | } |
| | | CString content; |
| | | for (std::list<CString>::iterator el = tempList.begin(); el != tempList.end(); ++el) { |
| | | content.Append(*el); |
| | | content.Append(L"\r\n"); |
| | | dlg->logList.push_back(*el); |
| | | } |
| | | tempList.clear(); |
| | | |
| | | |
| | | //追加文本 |
| | | int nLength = dlg->editLog.GetWindowTextLength(); |
| | | dlg->editLog.SetSel(nLength, nLength);//定位到文本末尾 |
| | | dlg->editLog.ReplaceSel(content);//在文本末尾追加 |
| | | |
| | | |
| | | if (dlg->logList.size() > dlg->MAX_LOG_LINES) { |
| | | //删除前几行 |
| | | int delLength = 0; |
| | | int delCount = 0; |
| | | int delLine = dlg->logList.size() - dlg->MAX_LOG_LINES; |
| | | for (int i = 0; i < delLine; i++) { |
| | | delCount += 1; |
| | | list<CString>::iterator its = (dlg->logList).begin(); |
| | | advance(its, i); |
| | | CString content = *its; |
| | | if (doc.IsObject() && doc[L"code"].GetInt() == 0) { |
| | | list<TradeDealRecord> tempRecordList; |
| | | //解析结果 |
| | | auto dataList = doc[L"data"][L"list"].GetArray(); |
| | | if (dataList.Size() > 0) { |
| | | dlg->logStartIndex += dataList.Size(); |
| | | std::list<CString> tempList; |
| | | for (int i = 0; i < dataList.Size(); i++) { |
| | | auto item = dataList[i].GetArray(); |
| | | CString time = item[0].GetString(); |
| | | CString level = item[1].GetString(); |
| | | CString content = item[2].GetString(); |
| | | CString contentStr = L""; |
| | | contentStr.Append(time.Mid(11)); |
| | | contentStr.Append(L" - "); |
| | | contentStr.Append(L"["); |
| | | contentStr.Append(level); |
| | | contentStr.Append(L"] "); |
| | | contentStr.Append(content); |
| | | tempList.push_back(contentStr); |
| | | } |
| | | CString content; |
| | | for (std::list<CString>::iterator el = tempList.begin(); el != tempList.end(); ++el) { |
| | | content.Append(*el); |
| | | content.Append(L"\r\n"); |
| | | delLength += content.GetLength(); |
| | | dlg->logList.push_back(*el); |
| | | } |
| | | for (int i = 0; i < delCount; i++) { |
| | | (dlg->logList).pop_front(); |
| | | } |
| | | //删除前面的文本 |
| | | dlg->editLog.SetSel(0, delLength); |
| | | dlg->editLog.ReplaceSel(_T("")); |
| | | tempList.clear(); |
| | | |
| | | |
| | | //追加文本 |
| | | int nLength = dlg->editLog.GetWindowTextLength(); |
| | | dlg->editLog.SetSel(nLength, nLength);//定位到文本末尾 |
| | | dlg->editLog.ReplaceSel(content);//在文本末尾追加 |
| | | |
| | | |
| | | if (dlg->logList.size() > dlg->MAX_LOG_LINES) { |
| | | //删除前几行 |
| | | int delLength = 0; |
| | | int delCount = 0; |
| | | int delLine = dlg->logList.size() - dlg->MAX_LOG_LINES; |
| | | for (int i = 0; i < delLine; i++) { |
| | | delCount += 1; |
| | | list<CString>::iterator its = (dlg->logList).begin(); |
| | | advance(its, i); |
| | | CString content = *its; |
| | | content.Append(L"\r\n"); |
| | | delLength += content.GetLength(); |
| | | } |
| | | for (int i = 0; i < delCount; i++) { |
| | | (dlg->logList).pop_front(); |
| | | } |
| | | //删除前面的文本 |
| | | dlg->editLog.SetSel(0, delLength); |
| | | dlg->editLog.ReplaceSel(_T("")); |
| | | int nLength = dlg->editLog.GetWindowTextLength(); |
| | | dlg->editLog.SetSel(nLength, nLength);//定位到文本末尾 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (...) { |
| | | catch (...) { |
| | | |
| | | |
| | | } |
| | | } |
| | | // 每1s请求一次 |
| | | Sleep(2000); |
| | |
| | | DDX_Control(pDX, IDC_BUTTON_SEARCH, btnSearch); |
| | | DDX_Control(pDX, IDC_STATIC_TODAY_K_BARS_COUNT, labelTodayKBarsCount); |
| | | DDX_Control(pDX, IDC_STATIC_DATA_SERVER_STATE, labelDataServerState); |
| | | DDX_Control(pDX, IDC_CHECK_READ_LOGS, checkAutoPullLogs); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | void MonitorDlg::OnBnClickedButtonSyncShszCodes() |
| | | { |
| | | CString msg = L""; |
| | | string result = NetworkApi::sync_l1_subscript_codes(); |
| | | auto resultDoc = JsonUtil::parseUTF8(result); |
| | | if (resultDoc.IsObject() && resultDoc["code"].GetInt() == 0) { |
| | | int count = resultDoc["data"]["codes_sh"].GetInt() + resultDoc["data"]["codes_sz"].GetInt(); |
| | | CString msg; |
| | | msg.Append(L"更新成功,代码总数:"); |
| | | msg.Append(L"L1代码更新:成功,代码总数:"); |
| | | msg.Append(std::to_wstring(count).c_str()); |
| | | MessageBox(msg, L"提示"); |
| | | } |
| | | else { |
| | | AfxMessageBox(L"更新失败"); |
| | | msg.Append(L"L1代码更新:失败\n"); |
| | | } |
| | | |
| | | result = NetworkApi::sync_radical_buy_special_codes(); |
| | | auto doc = JsonUtil::parseUTF16(result); |
| | | if (doc.IsObject() && doc[L"code"].GetInt() == 0) { |
| | | msg.Append(L"扫入辨识度代码更新:成功,"); |
| | | msg.Append(doc[L"msg"].GetString()); |
| | | } |
| | | else { |
| | | msg.Append(L"扫入辨识度代码更新:失败\n"); |
| | | } |
| | | MessageBox(msg, L"提示"); |
| | | } |
| | | |
| | | |