diff --git a/src/pPowerManger/httpserver/httpserver.cpp b/src/pPowerManger/httpserver/httpserver.cpp index 8a78811..dd833ca 100644 --- a/src/pPowerManger/httpserver/httpserver.cpp +++ b/src/pPowerManger/httpserver/httpserver.cpp @@ -7,6 +7,7 @@ #include "json/json.h" #include #include "data.h" +#include "logpage.h" using json = Json::Value; @@ -67,6 +68,9 @@ void HttpServer::handleWebSocketEvent(struct mg_connection* c, int ev, void* ev_ } else if (mg_match(hm->uri, mg_str("/data"), NULL)) { // 返回数据页面HTML mg_http_reply(c, 200, "Content-Type: text/html; charset=utf-8\r\n", DATA_HTML.c_str()); + } else if (mg_match(hm->uri, mg_str("/logs"), NULL)) { + // 返回日志页面HTML + mg_http_reply(c, 200, "Content-Type: text/html; charset=utf-8\r\n", LOG_PAGE_HTML.c_str()); } else if (mg_match(hm->uri, mg_str("/control"), NULL)) { // 处理断路器控制请求 if (mg_strcmp(hm->method, mg_str("POST")) == 0) { @@ -170,10 +174,7 @@ void HttpServer::handleWebSocketEvent(struct mg_connection* c, int ev, void* ev_ success = m_lowerCommManager->operate_LVA_mergencyLithiumBatteryGroup1Circuit_Breaker(opt); } } - - const char *message = success ? "操作成功" : "操作失败"; - // 返回JSON响应 mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{\"success\": %s, \"message\": \"%s\"}", diff --git a/src/pPowerManger/httpserver/httpserver.h b/src/pPowerManger/httpserver/httpserver.h index 821892c..0589c55 100644 --- a/src/pPowerManger/httpserver/httpserver.h +++ b/src/pPowerManger/httpserver/httpserver.h @@ -10,7 +10,6 @@ #include #include #include "../LowerCommManager.h" -#include "../PowerManger.h" #include #include #include @@ -86,13 +85,6 @@ private: std::deque m_logCache; // 缓存最近的日志 static const size_t MAX_CACHE_SIZE = 1000; // 最大缓存条数 - // Log monitoring - std::string m_logPath; - std::deque m_logCache; - std::mutex m_logMutex; - std::vector m_logSubscribers; - std::mutex m_subscriberMutex; - std::atomic m_lastLogSize; }; #endif // HTTP_SERVER_H \ No newline at end of file