| | |
| | | */
|
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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", vssUpperSvrTblBuilder.buildVssUpperSvrTblMap());
|
| | | }
|
| | | return responseJsonValue.toStyledString();
|
| | | }
|
| | | |
| | |
|
| | | /** 查找创建上级平台服务器表列表 */
|
| | | std::string findVssUpperSvrTblList(std::string ip, unsigned int port, std::string content, PResponse &response) {
|
| | | Json::Reader requestJsonReader;
|
| | |
| | | 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", vssUpperSvrTblBuilder.buildVssUpperSvrTblMap());
|
| | |
|
| | | }
|
| | | return responseJsonValue.toStyledString();
|