增加了log页面,但是没有后端
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "json/json.h"
|
||||
#include <sys/resource.h>
|
||||
#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\"}",
|
||||
|
||||
Reference in New Issue
Block a user