mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改场站策略解析及网关指令下发
This commit is contained in:
@@ -341,7 +341,7 @@ Errcode HttpEntity::login(const httplib::Request& req, njson& json, std::string&
|
||||
json["permission"] = nodePermission;
|
||||
}
|
||||
|
||||
DAO::insertSystemLogUser(token, "用户登录:" + ErrcodeStr(err), (err==Errcode::OK) ? 0: 1);
|
||||
DAO::insertSystemLogUser(token, "用户登录:" + ErrcodeStr(err), (err==Errcode::OK) ? 1: 0);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ Errcode HttpEntity::queryUserList(const httplib::Request& req, njson& json, std:
|
||||
{
|
||||
HttpHelper::setPagination(pageinfo, result, json);
|
||||
}
|
||||
DAO::insertSystemLogUser(token, "查询用户列表:" + ErrcodeStr(err), (err==Errcode::OK) ? 0 : 1);
|
||||
//DAO::insertSystemLogUser(token, "查询用户列表:" + ErrcodeStr(err), (err==Errcode::OK) ? 1 : 0);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -601,12 +601,38 @@ Errcode HttpEntity::insertStation(const httplib::Request& req, njson& json, std:
|
||||
Errcode HttpEntity::updateStation(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
{
|
||||
Fields params;
|
||||
GetRequestParam(req, {"station_id", "name", "address", "lon", "lat", "tel", "capacity", "status", "work_mode"}, params);
|
||||
GetRequestParam(req, {"station_id", "name", "address", "lon", "lat", "tel", "capacity", "status", "work_mode", "policy_id"}, params);
|
||||
std::string stationId = params.value("station_id");
|
||||
params.check("capacity", "", "0.0");
|
||||
params.check("lon", "", "0.0");
|
||||
params.check("lat", "", "0.0");
|
||||
params.check("status", "", "1");
|
||||
return DAO::updateStationById(params);
|
||||
Errcode err = DAO::updateStationById(params);
|
||||
if (err == Errcode::OK)
|
||||
{
|
||||
std::string sql = "SELECT s.*, p.name policy_name, p.`type` policy_type, p.value FROM station s LEFT JOIN policy p ON s.policy_id=p.policy_id"
|
||||
" WHERE s.station_id='" + stationId + "';";
|
||||
std::vector<Fields> result;
|
||||
int ret = DaoEntity::execOnce(sql, result);
|
||||
if (ret != 0)
|
||||
{
|
||||
spdlog::error("[http] update station success, set station cache error, station_id={}", stationId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.size() > 0)
|
||||
{
|
||||
auto station = Application::data().getStation(Utils::toInt(stationId));
|
||||
if (station)
|
||||
{
|
||||
station->setFields(result[0]);
|
||||
station->setGarewayWorkMode();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return err;
|
||||
};
|
||||
|
||||
Errcode HttpEntity::deleteStation(const httplib::Request& req, njson& json, std::string& errmsg)
|
||||
|
||||
Reference in New Issue
Block a user