实现服务端的QT应用界面

This commit is contained in:
lixiaoyuan
2025-09-24 19:06:31 +08:00
parent 0abb4e54f1
commit d7888c2be4
26 changed files with 435 additions and 173 deletions

View File

@@ -369,7 +369,7 @@ Errcode HttpEntity::login(const httplib::Request& req, njson& json, std::string&
json["permission"] = nodePermission;
}
DAO::insertSystemLogUser(token, "用户登录:" + ErrcodeStr(err), (err==Errcode::OK) ? 1: 0);
DAO::insertSystemLogUser(token, "用户[" + account + "]登录:" + ErrcodeStr(err), (err==Errcode::OK) ? 1: 0);
return err;
}
@@ -636,6 +636,7 @@ Errcode HttpEntity::updateStation(const httplib::Request& req, njson& json, std:
params.check("lat", "", "0.0");
params.check("status", "", "1");
params.check("policy_id", "", "NULL");
params.check("operation_date", "", "NULL");
Errcode err = DAO::updateStationById(params);
if (err == Errcode::OK)
{
@@ -861,7 +862,7 @@ Errcode HttpEntity::queryDevicByCategory(const httplib::Request& req, njson& jso
njson jsondata = njson::array();
auto station = Application::data().getStation(stationId);
if (station && station->status == 1)
if (station)
{
std::vector<std::shared_ptr<Device>> vecDevice;
station->getDeviceByCategory(category, vecDevice);
@@ -1158,8 +1159,8 @@ static std::string VerifyStatSqlCondition(Fields& params)
}
if (!category.empty() && category != "0")
{
if (!sqlCondition.empty()) sqlCondition += " AND ";
sqlCondition += "ss.category='" + category + "'";;
//if (!sqlCondition.empty()) sqlCondition += " AND ";
//sqlCondition += "ss.category='" + category + "'";;
}
if (!sqlCondition.empty()) { sqlCondition = " WHERE " + sqlCondition; }
return sqlCondition;
@@ -1399,8 +1400,8 @@ Errcode HttpEntity::exportStatReport(const httplib::Request& req, njson& json, s
std::string endDate = params.value("end_date");
std::string sql = "SELECT s.name station_name, sd.* FROM stat_day sd LEFT JOIN station s ON sd.station_id=s.station_id";
" WHERE station_id = '" + stationId + "' AND category = '" + category + "'"
" AND dt BETWEEN '" + startDate + "' AND '" + endDate + "2025-09-19' AND sd.category = '1'";
sql += " WHERE sd.station_id = '" + stationId + "' AND category = '" + category + "'";
sql += " AND dt BETWEEN '" + startDate + "' AND '" + endDate + "2025-09-19' AND sd.category = '1'";
std::string filename;
std::vector<Fields> result;