1、合并部分代码
This commit is contained in:
@@ -69,7 +69,7 @@ void GetVersion::makeGetVersionReponse(std::string tokenStr,msg_t &outMsg) {
|
||||
nlohmann::json js;
|
||||
js["token"] = tokenStr;
|
||||
js["time"] = ToolUtils::getTimeStringWithFomat(false);
|
||||
js["data"] = {{"version","shb-xxxx"}};
|
||||
js["data"] = {{"version",SOFT_VERSION}};
|
||||
|
||||
outMsg.topic = "/sys.dbc/sys.brd/S-datacenter/F-GetVersion";
|
||||
outMsg.payload = js.dump();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "bizservice.h"
|
||||
#include "queue.h"
|
||||
#define SOFT_VERSION "shb-V1.0.0" //数据中心软件版本号
|
||||
|
||||
class GetVersion : public IBizService
|
||||
{
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
#include "datacenter/bizService/F-GetVersion.h"
|
||||
#include "ToolUtils.h"
|
||||
|
||||
#include "Database.h"
|
||||
#include "ConnectionPool.h"
|
||||
|
||||
ConnectionPool pool(POOLSIZE);
|
||||
|
||||
REGISTER_SERVICE(DataCenter);
|
||||
|
||||
int WriteResponseMsg(msg_t msg) {
|
||||
@@ -28,6 +33,7 @@ void DataCenter::datacenterinit(void) {
|
||||
return;
|
||||
|
||||
objmqttClient->connectServer();
|
||||
//todo 发送上线通知
|
||||
}
|
||||
|
||||
void DataCenter::ExecPoll(void) {
|
||||
@@ -86,7 +92,11 @@ bool DataCenter::handleMsg(msg_mqtt_t inMqttMsg) {
|
||||
if(itor == map.end()){
|
||||
return false;
|
||||
}
|
||||
fRet = itor->second->HandleMsg(intMsg,outMsg, NULL);
|
||||
|
||||
Database *conn = pool.getConnection(); // 获取数据库连接
|
||||
sqlite3 *db = conn->GetHandle(); // 获取数据库句柄
|
||||
fRet = itor->second->HandleMsg(intMsg, outMsg, (handparam_t *)db);
|
||||
pool.returnConnection(conn); // 归还数据库连接
|
||||
if (fRet == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user