|
|
@@ -17,11 +17,13 @@ using std::regex;
|
|
|
bool CenterSettingResponse::Parse(string strData)
|
|
|
{
|
|
|
bSuccess = false;
|
|
|
+ errInfo.clear();
|
|
|
|
|
|
Json::Value root;
|
|
|
Json::Reader reader;
|
|
|
if (!reader.parse(strData, root, false)) {
|
|
|
- Dbg("%d", __LINE__);
|
|
|
+ errInfo = "parse json string failed: ";
|
|
|
+ errInfo += strData;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -30,8 +32,13 @@ bool CenterSettingResponse::Parse(string strData)
|
|
|
JSONCONVERT2OBJECT_MEMEBER_RENAME_REGISTER("success", "code", "return_code", "error_msg", "message")
|
|
|
} reponseStatus;
|
|
|
|
|
|
- if (!Json2Object(reponseStatus, root) || !reponseStatus.IsReqBusinessSucc()) {
|
|
|
- Dbg("%d", __LINE__);
|
|
|
+ if (!Json2Object(reponseStatus, root)) {
|
|
|
+ errInfo = "Json2Object failed";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!reponseStatus.IsReqBusinessSucc()) {
|
|
|
+ errInfo = reponseStatus.WhatError();
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -40,7 +47,7 @@ bool CenterSettingResponse::Parse(string strData)
|
|
|
centerSyncInfo.biz.mapSiteName = "LAN";
|
|
|
centerSyncInfo.dmz.mapSiteName = "DMZ";
|
|
|
} else {
|
|
|
- Dbg("%d", __LINE__);
|
|
|
+ errInfo = "parse json data node failed: ";
|
|
|
}
|
|
|
return bSuccess;
|
|
|
}
|
|
|
@@ -124,7 +131,7 @@ ErrorCodeEnum CenterSettingsMicroServiceHelper::GrayLaunch(BOOL& grayLaunch)
|
|
|
}
|
|
|
|
|
|
|
|
|
-ErrorCodeEnum CenterSettingsMicroServiceHelper::GetCenterSetting()
|
|
|
+ErrorCodeEnum CenterSettingsMicroServiceHelper::GetCenterSetting(CSimpleStringA& strErrMsg)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
CenterSettingReq req;
|
|
|
@@ -139,25 +146,30 @@ ErrorCodeEnum CenterSettingsMicroServiceHelper::GetCenterSetting()
|
|
|
bool ret = pHttpFunc->Post(req, response);
|
|
|
pHttpFunc->Destory();
|
|
|
|
|
|
- if (ret && response.bSuccess) {
|
|
|
+ if (ret) {
|
|
|
+ if (response.bSuccess) {
|
|
|
+ if ((mTerminalInfo.strSite.Compare("cmb.LIB", true) == 0 && response.centerSyncInfo.biz.lastUpdateTime == req.m_last_update_time)
|
|
|
+ || (mTerminalInfo.strSite.Compare("cmb.FLB", true) == 0 && response.centerSyncInfo.dmz.lastUpdateTime == req.m_last_update_time)) {//行内
|
|
|
+ Dbg("Centersetting not changed.");
|
|
|
+ return Error_Succeed;
|
|
|
+ }
|
|
|
+
|
|
|
+ CenterSettingConfigJson& cur = response.centerSyncInfo.dmz;
|
|
|
+ if (mTerminalInfo.strSite.Compare("cmb.LIB", true) == 0) {
|
|
|
+ cur = response.centerSyncInfo.biz;
|
|
|
+ }
|
|
|
+ Dbg("local last update time(%s) vs server last update time(%s)", cur.lastUpdateTime.c_str(), req.m_last_update_time.c_str());
|
|
|
+ SyncConfigAndRenameCenterFile(cur);
|
|
|
+ LogEvent(Severity_Middle, EVENT_MOD_CENTERSETTING_UPDATE,
|
|
|
+ CSimpleString::Format("Update CenterSetting.%s.ini.", cur.mapSiteName.c_str()));
|
|
|
|
|
|
- if ((mTerminalInfo.strSite.Compare("cmb.LIB", true) == 0 && response.centerSyncInfo.biz.lastUpdateTime == req.m_last_update_time)
|
|
|
- || (mTerminalInfo.strSite.Compare("cmb.FLB", true) == 0 && response.centerSyncInfo.dmz.lastUpdateTime == req.m_last_update_time)) {//行内
|
|
|
- Dbg("Centersetting not changed.");
|
|
|
return Error_Succeed;
|
|
|
+ } else {
|
|
|
+ strErrMsg = response.errInfo.c_str();
|
|
|
}
|
|
|
-
|
|
|
- CenterSettingConfigJson& cur = response.centerSyncInfo.dmz;
|
|
|
- if (mTerminalInfo.strSite.Compare("cmb.LIB", true) == 0) {
|
|
|
- cur = response.centerSyncInfo.biz;
|
|
|
- }
|
|
|
- Dbg("local last update time(%s) vs server last update time(%s)", cur.lastUpdateTime.c_str(), req.m_last_update_time.c_str());
|
|
|
- SyncConfigAndRenameCenterFile(cur);
|
|
|
- LogEvent(Severity_Middle, EVENT_MOD_CENTERSETTING_UPDATE,
|
|
|
- CSimpleString::Format("Update CenterSetting.%s.ini.", cur.mapSiteName.c_str()));
|
|
|
-
|
|
|
- return Error_Succeed;
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ strErrMsg = CSimpleStringA::Format("post [%s] failed!", req.m_url.c_str());
|
|
|
+ }
|
|
|
|
|
|
return Error_Unexpect;
|
|
|
}
|