From d3b7bbe7102cd089680a828f5d8f6402c8cf6342 Mon Sep 17 00:00:00 2001 From: pansen <pansen626@sina.com> Date: 星期四, 07 三月 2019 14:43:28 +0800 Subject: [PATCH] GB28181集成完成,集成推流模块 --- QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h | 500 +++++++++++++++++++++++++++--------------------------- 1 files changed, 250 insertions(+), 250 deletions(-) diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h index 300d89c..156c4e7 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h +++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h @@ -16,46 +16,46 @@ */ class VssUpperSvrTblController : public VssBaseController { private: - /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鏋勯�犲嚱鏁� */ - VssUpperSvrTblController() {} + /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鏋勯�犲嚱鏁� */ + VssUpperSvrTblController() {} public: - /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍗曚緥妯″紡 */ + /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍗曚緥妯″紡 */ static VssUpperSvrTblController* instance() { static VssUpperSvrTblController instance; return &instance; } public: - /** 娉ㄥ唽{label}http鏈嶅姟 */ + /** 娉ㄥ唽{label}http鏈嶅姟 */ void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) { - _HttpSrvRetRecieve.setInfo("^/addVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::addVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/delVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::delVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/updateVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::updateVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::findVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTblList$", "POST", - std::bind(&VssUpperSvrTblController::findVssUpperSvrTblList, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); + _HttpSrvRetRecieve.setInfo("^/addVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::addVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/delVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::delVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/updateVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::updateVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::findVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTblList$", "POST", + std::bind(&VssUpperSvrTblController::findVssUpperSvrTblList, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); } public: - /** 娣诲姞鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ + /** 娣诲姞鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string addVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; Json::Value requestJsonValue; @@ -64,98 +64,98 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - auto keyValuesToAdd = vssUpperSvrTblBuilder.buildVssUpperSvrTblMap(); - if (keyValuesToAdd.size() > 0) { - mysqlpp::SimpleResult addVssUpperSvrTblResult = VssUpperSvrTblDao::instance()->addVssUpperSvrTbl(keyValuesToAdd); - if (addVssUpperSvrTblResult.rows() > 0) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; - } + auto keyValuesToAdd = vssUpperSvrTblBuilder.buildVssUpperSvrTblMap(); + if (keyValuesToAdd.size() > 0) { + mysqlpp::SimpleResult addVssUpperSvrTblResult = VssUpperSvrTblDao::instance()->addVssUpperSvrTbl(keyValuesToAdd); + if (addVssUpperSvrTblResult.rows() > 0) { + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鍒犻櫎鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string delVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -164,19 +164,19 @@ responseJsonValue["message"] = "鍒犻櫎澶辫触锛�"; responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssUpperSvrTblDao::instance()->deleteByColumn("ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; + } } - + } return responseJsonValue.toStyledString(); } - + /** 鏇存柊鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string updateVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -186,97 +186,97 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssUpperSvrTblDao::instance()->updateVssUpperSvrTbl(vssUpperSvrTblBuilder.buildVssUpperSvrTblMap(), "ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍗曚釜鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string findVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -286,93 +286,93 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1 limit 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1 limit 1"); } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍒楄〃 */ std::string findVssUpperSvrTblList(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -382,89 +382,89 @@ responseJsonValue["success"] = "false"; if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1"); } return responseJsonValue.toStyledString(); -- Gitblit v1.8.0