From 55337c3876fa54863463ab7c30a7ed0fcb3c88e5 Mon Sep 17 00:00:00 2001
From: chenshijun <chenshijun@aiotlink.com>
Date: 星期四, 21 三月 2019 14:43:15 +0800
Subject: [PATCH] facesearchserver出现段错误,map的operater[],疑似该处,加些调试信息。
---
QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h | 968 ++++++++++++++++++++++++++++----------------------------
1 files changed, 484 insertions(+), 484 deletions(-)
diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h
index 50af7f0..25e2a79 100755
--- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h
+++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h
@@ -1,484 +1,484 @@
-#ifndef VSSUPPERSVRTBL_CONTROLLER_H
-#define VSSUPPERSVRTBL_CONTROLLER_H
-
-#include <string>
-#include <DataManagerServer/http_configserver.h>
-#include "vss/dao/VssUpperSvrTblDao.h"
-#include "vss/model/VssUpperSvrTblBuilder.h"
-#include "vss/model/VssUpperSvrTbl.h"
-#include "VssBaseController.h"
-#include <mysql++.h>
-
-using namespace std;
-
-/**
- * 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃
- */
-class VssUpperSvrTblController : public VssBaseController {
-private:
- /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鏋勯�犲嚱鏁� */
- VssUpperSvrTblController() {}
-public:
- /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍗曚緥妯″紡 */
- static VssUpperSvrTblController* instance() {
- static VssUpperSvrTblController instance;
- return &instance;
- }
-public:
- /** 娉ㄥ唽{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));
-
- }
-public:
- /** 娣诲姞鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */
- std::string addVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
- Json::Reader requestJsonReader;
- Json::Value requestJsonValue;
- Json::Value responseJsonValue;
- responseJsonValue["message"] = "娣诲姞澶辫触锛�";
- responseJsonValue["success"] = "false";
- if (requestJsonReader.parse(content, requestJsonValue)) {
- VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
-
- Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
- if (iDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addID(iDJsonValue.asInt());
- }
-
- Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
- if (nameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addName(nameJsonValue.asString());
- }
-
- Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
- if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString());
- }
-
- Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
- if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString());
- }
-
- Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
- if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString());
- }
-
- Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
- if (domainJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString());
- }
-
- Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
- if (iPJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIP(iPJsonValue.asString());
- }
-
- Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
- if (portJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPort(portJsonValue.asInt());
- }
-
- Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
- if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt());
- }
-
- Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
- if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt());
- }
-
- Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
- if (aliveJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt());
- }
-
- Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
- if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt());
- }
-
- Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
- if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt());
- }
-
- Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
- if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt());
- }
-
- Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
- if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt());
- }
-
- Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
- if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
- 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"] = "娣诲姞鎴愬姛锛�";
- }
- }
- }
- return responseJsonValue.toStyledString();
- }
-
- /** 鍒犻櫎鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */
- std::string delVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
- Json::Reader requestJsonReader;
- Json::Value requestJsonValue;
- Json::Value responseJsonValue;
- 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();
- if (iDValue.size() > 0 && VssUpperSvrTblDao::instance()->deleteByColumn("ID", iDValue)) {
- 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;
- Json::Value requestJsonValue;
- Json::Value responseJsonValue;
- responseJsonValue["message"] = "鏇存柊澶辫触锛�";
- responseJsonValue["success"] = "false";
- if (requestJsonReader.parse(content, requestJsonValue)) {
- VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
-
- Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
- if (iDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addID(iDJsonValue.asInt());
- }
-
- Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
- if (nameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addName(nameJsonValue.asString());
- }
-
- Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
- if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString());
- }
-
- Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
- if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString());
- }
-
- Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
- if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString());
- }
-
- Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
- if (domainJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString());
- }
-
- Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
- if (iPJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIP(iPJsonValue.asString());
- }
-
- Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
- if (portJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPort(portJsonValue.asInt());
- }
-
- Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
- if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt());
- }
-
- Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
- if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt());
- }
-
- Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
- if (aliveJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt());
- }
-
- Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
- if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt());
- }
-
- Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
- if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt());
- }
-
- Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
- if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt());
- }
-
- Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
- if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt());
- }
-
- Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
- if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.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"] = "鏇存柊鎴愬姛锛�";
- }
- }
- }
- return responseJsonValue.toStyledString();
- }
-
- /** 鏌ユ壘鍗曚釜鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */
- std::string findVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
- Json::Reader requestJsonReader;
- Json::Value requestJsonValue;
- Json::Value responseJsonValue;
- responseJsonValue["message"] = "鏌ヨ澶辫触锛�";
- responseJsonValue["success"] = "false";
- if (requestJsonReader.parse(content, requestJsonValue)) {
- VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
-
- Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
- if (iDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addID(iDJsonValue.asInt());
- }
-
- Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
- if (nameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addName(nameJsonValue.asString());
- }
-
- Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
- if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString());
- }
-
- Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
- if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString());
- }
-
- Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
- if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString());
- }
-
- Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
- if (domainJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString());
- }
-
- Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
- if (iPJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIP(iPJsonValue.asString());
- }
-
- Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
- if (portJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPort(portJsonValue.asInt());
- }
-
- Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
- if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt());
- }
-
- Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
- if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt());
- }
-
- Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
- if (aliveJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt());
- }
-
- Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
- if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt());
- }
-
- Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
- if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt());
- }
-
- Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
- if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt());
- }
-
- Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
- if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt());
- }
-
- Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
- if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
- 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");
- }
- return responseJsonValue.toStyledString();
- }
-
- /** 鏌ユ壘鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍒楄〃 */
- std::string findVssUpperSvrTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
- Json::Reader requestJsonReader;
- Json::Value requestJsonValue;
- Json::Value responseJsonValue;
- responseJsonValue["message"] = "鏌ヨ澶辫触锛�";
- responseJsonValue["success"] = "false";
- if (content == "" || requestJsonReader.parse(content, requestJsonValue)) {
- VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
-
- Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
- if (iDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addID(iDJsonValue.asInt());
- }
-
- Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
- if (nameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addName(nameJsonValue.asString());
- }
-
- Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
- if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString());
- }
-
- Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
- if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString());
- }
-
- Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
- if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString());
- }
-
- Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
- if (domainJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString());
- }
-
- Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
- if (iPJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIP(iPJsonValue.asString());
- }
-
- Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
- if (portJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPort(portJsonValue.asInt());
- }
-
- Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
- if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt());
- }
-
- Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
- if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt());
- }
-
- Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
- if (aliveJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt());
- }
-
- Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
- if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt());
- }
-
- Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
- if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt());
- }
-
- Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
- if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt());
- }
-
- Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
- if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt());
- }
-
- Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
- if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
- vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString());
- }
- responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�";
- responseJsonValue["success"] = "true";
- responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1");
-
- }
- return responseJsonValue.toStyledString();
- }
-};
-
-
-
-
-
-
-#endif //VSSUPPERSVRTBL_CONTROLLER_H
-
-
-
-
-
+#ifndef VSSUPPERSVRTBL_CONTROLLER_H
+#define VSSUPPERSVRTBL_CONTROLLER_H
+
+#include <string>
+#include <DataManagerServer/http_configserver.h>
+#include "vss/dao/VssUpperSvrTblDao.h"
+#include "vss/model/VssUpperSvrTblBuilder.h"
+#include "vss/model/VssUpperSvrTbl.h"
+#include "VssBaseController.h"
+#include <mysql++.h>
+
+using namespace std;
+
+/**
+ * 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃
+ */
+class VssUpperSvrTblController : public VssBaseController {
+private:
+ /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鏋勯�犲嚱鏁� */
+ VssUpperSvrTblController() {}
+public:
+ /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍗曚緥妯″紡 */
+ static VssUpperSvrTblController* instance() {
+ static VssUpperSvrTblController instance;
+ return &instance;
+ }
+public:
+ /** 娉ㄥ唽{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));
+
+ }
+public:
+ /** 娣诲姞鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */
+ std::string addVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+ Json::Reader requestJsonReader;
+ Json::Value requestJsonValue;
+ Json::Value responseJsonValue;
+ responseJsonValue["message"] = "娣诲姞澶辫触锛�";
+ responseJsonValue["success"] = "false";
+ if (requestJsonReader.parse(content, requestJsonValue)) {
+ VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
+
+ Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
+ if (iDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString())));
+ }
+
+ Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
+ if (nameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addName((nameJsonValue.asString()));
+ }
+
+ Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
+ if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString()));
+ }
+
+ Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
+ if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString()));
+ }
+
+ Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
+ if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString()));
+ }
+
+ Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
+ if (domainJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString()));
+ }
+
+ Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
+ if (iPJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIP((iPJsonValue.asString()));
+ }
+
+ Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
+ if (portJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString())));
+ }
+
+ Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
+ if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString())));
+ }
+
+ Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
+ if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString())));
+ }
+
+ Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
+ if (aliveJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString())));
+ }
+
+ Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
+ if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString())));
+ }
+
+ Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
+ if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString())));
+ }
+
+ Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
+ if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString())));
+ }
+
+ Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
+ if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString())));
+ }
+
+ Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
+ if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
+ 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"] = "娣诲姞鎴愬姛锛�";
+ }
+ }
+ }
+ return responseJsonValue.toStyledString();
+ }
+
+ /** 鍒犻櫎鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */
+ std::string delVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+ Json::Reader requestJsonReader;
+ Json::Value requestJsonValue;
+ Json::Value responseJsonValue;
+ 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();
+ if (iDValue.size() > 0 && VssUpperSvrTblDao::instance()->deleteByColumn("ID", iDValue)) {
+ 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;
+ Json::Value requestJsonValue;
+ Json::Value responseJsonValue;
+ responseJsonValue["message"] = "鏇存柊澶辫触锛�";
+ responseJsonValue["success"] = "false";
+ if (requestJsonReader.parse(content, requestJsonValue)) {
+ VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
+
+ Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
+ if (iDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString())));
+ }
+
+ Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
+ if (nameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addName((nameJsonValue.asString()));
+ }
+
+ Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
+ if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString()));
+ }
+
+ Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
+ if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString()));
+ }
+
+ Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
+ if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString()));
+ }
+
+ Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
+ if (domainJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString()));
+ }
+
+ Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
+ if (iPJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIP((iPJsonValue.asString()));
+ }
+
+ Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
+ if (portJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString())));
+ }
+
+ Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
+ if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString())));
+ }
+
+ Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
+ if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString())));
+ }
+
+ Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
+ if (aliveJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString())));
+ }
+
+ Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
+ if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString())));
+ }
+
+ Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
+ if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString())));
+ }
+
+ Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
+ if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString())));
+ }
+
+ Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
+ if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString())));
+ }
+
+ Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
+ if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.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"] = "鏇存柊鎴愬姛锛�";
+ }
+ }
+ }
+ return responseJsonValue.toStyledString();
+ }
+
+ /** 鏌ユ壘鍗曚釜鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */
+ std::string findVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) {
+ Json::Reader requestJsonReader;
+ Json::Value requestJsonValue;
+ Json::Value responseJsonValue;
+ responseJsonValue["message"] = "鏌ヨ澶辫触锛�";
+ responseJsonValue["success"] = "false";
+ if (requestJsonReader.parse(content, requestJsonValue)) {
+ VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
+
+ Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
+ if (iDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString())));
+ }
+
+ Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
+ if (nameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addName((nameJsonValue.asString()));
+ }
+
+ Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
+ if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString()));
+ }
+
+ Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
+ if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString()));
+ }
+
+ Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
+ if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString()));
+ }
+
+ Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
+ if (domainJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString()));
+ }
+
+ Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
+ if (iPJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIP((iPJsonValue.asString()));
+ }
+
+ Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
+ if (portJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString())));
+ }
+
+ Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
+ if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString())));
+ }
+
+ Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
+ if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString())));
+ }
+
+ Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
+ if (aliveJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString())));
+ }
+
+ Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
+ if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString())));
+ }
+
+ Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
+ if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString())));
+ }
+
+ Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
+ if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString())));
+ }
+
+ Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
+ if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString())));
+ }
+
+ Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
+ if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
+ 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", vssUpperSvrTblBuilder.buildVssUpperSvrTblMap());
+ }
+ return responseJsonValue.toStyledString();
+ }
+
+ /** 鏌ユ壘鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍒楄〃 */
+ std::string findVssUpperSvrTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
+ Json::Reader requestJsonReader;
+ Json::Value requestJsonValue;
+ Json::Value responseJsonValue;
+ responseJsonValue["message"] = "鏌ヨ澶辫触锛�";
+ responseJsonValue["success"] = "false";
+ if (content == "" || requestJsonReader.parse(content, requestJsonValue)) {
+ VssUpperSvrTblBuilder vssUpperSvrTblBuilder;
+
+ Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID];
+ if (iDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString())));
+ }
+
+ Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name];
+ if (nameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addName((nameJsonValue.asString()));
+ }
+
+ Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID];
+ if (publicIDJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString()));
+ }
+
+ Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername];
+ if (authUsernameJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString()));
+ }
+
+ Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd];
+ if (authPasswdJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString()));
+ }
+
+ Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain];
+ if (domainJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString()));
+ }
+
+ Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP];
+ if (iPJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIP((iPJsonValue.asString()));
+ }
+
+ Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port];
+ if (portJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString())));
+ }
+
+ Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime];
+ if (registerTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString())));
+ }
+
+ Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime];
+ if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString())));
+ }
+
+ Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive];
+ if (aliveJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString())));
+ }
+
+ Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime];
+ if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString())));
+ }
+
+ Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol];
+ if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString())));
+ }
+
+ Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo];
+ if (platformInfoJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString())));
+ }
+
+ Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable];
+ if (isEnableJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString())));
+ }
+
+ Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime];
+ if (updateTimeJsonValue.type() != Json::ValueType::nullValue) {
+ vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString()));
+ }
+ responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�";
+ responseJsonValue["success"] = "true";
+ responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1", vssUpperSvrTblBuilder.buildVssUpperSvrTblMap());
+
+ }
+ return responseJsonValue.toStyledString();
+ }
+};
+
+
+
+
+
+
+#endif //VSSUPPERSVRTBL_CONTROLLER_H
+
+
+
+
+
--
Gitblit v1.8.0