调试修改HTTP接口

This commit is contained in:
lixiaoyuan
2025-09-05 19:44:26 +08:00
parent c1cce63c85
commit aca9a8f0ae
34 changed files with 2142 additions and 179 deletions

View File

@@ -40,7 +40,7 @@ void AppData::initFromDB()
auto dao = DaoEntity::create("");
if (!dao->isConnected())
{
spdlog::info("Database connected error.");
spdlog::error("Init app data failed, database connected error.");
return;
}

View File

@@ -16,6 +16,9 @@ void Application::init()
// 初始化系统配置,读取配置文件
Config::init("assets/config/app.json");
// MQTT 数据结构
MqttClient::loadDataStruct("assets/config/registeraddr.json");
// 设置数据库配置
DaoEntity::setOption(Config::option.database.host,
Config::option.database.port,

View File

@@ -3,12 +3,6 @@
#include <cstdint>
#include "common/JsonN.h"
struct REGInfo
{
std::string name;
int byte;
std::string remark;
};
// EMS遥信
struct EMSYX
@@ -43,7 +37,7 @@ struct EMSYX
uint16_t energyStatus; //判断总表的三相总有功 < -5.0fkW 充电 >5.0fkW放电 否则停机 R uint16 0:充电 1 : 放电 2 : 停机 储能状态
void fromJson(const std::string& str);
void toJson();
std::string toJson();
};
// EMS遥测

View File

@@ -4,22 +4,21 @@
enum class Errcode
{
OK = 0,
ERR = 1,
ERR_TOKEN, // TOKEN错误
ERR_PARAM, // 参数错误
ERR_PARAM_NUL, // 缺少参数
ERR_DATA_NUL, // 数据不存在
OK = 0, // 成功
ERR = 1, // 系统错误
ERR_TOKEN = 2, // TOKEN错误
ERR_PARAM = 3, // 参数错误
ERR_PARAM_NUL = 4, // 缺少参数
ERR_DATA_NUL = 5, // 数据不存在
ERR_USER = 100,
ERR_LOGIN_USER_NOTEXIST, // 登入错误,用户不存在
ERR_LOGIN_PASSWD, // 登入错误,密码不正确
ERR_LOGIN_USER_NOTEXIST = 101, // 登入错误,用户不存在
ERR_LOGIN_PASSWD = 102, // 登入错误,密码不正确
ERR_DEVICE = 200,
ERR_DB_CONN = 1001, // 数据库连接错误
ERR_DB_CONN = 1001, // 数据库连接错误
ERR_DB_DUPLICATE = 1062, // Duplicate entry for key
ERR_DB_SQL = 1064, // 数据库查询SQL错误
ERR_DB_VAL = 1366, // 1366,Incorrect decimal value通常为参数值错误例如空值、值类型错误