修正json消息体
This commit is contained in:
parent
b8301d704f
commit
8252a9e004
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "httplib.h"
|
#include "httplib.h"
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
|
#include "nlohmann/json.hpp"
|
||||||
#include "serial_port.h"
|
#include "serial_port.h"
|
||||||
|
|
||||||
// ================== 全局 IMEI ==================
|
// ================== 全局 IMEI ==================
|
||||||
@ -67,18 +68,11 @@ void start_http_server(int port)
|
|||||||
|
|
||||||
std::string imei = get_imei();
|
std::string imei = get_imei();
|
||||||
|
|
||||||
std::ostringstream oss;
|
nlohmann::json j;
|
||||||
oss << R"({
|
j["ok"] = true;
|
||||||
"ok": true,
|
j["server"] = {{"device_type", "tbox"}, {"imei", imei}, {"fw", "b-v2.1.0"}};
|
||||||
"server": {
|
|
||||||
"device_type": "tbox",
|
|
||||||
"imei": ")"
|
|
||||||
<< imei << R"(",
|
|
||||||
"fw": "b-v2.1.0"
|
|
||||||
}
|
|
||||||
})";
|
|
||||||
|
|
||||||
res.set_content(oss.str(), "application/json");
|
res.set_content(j.dump(2), "application/json");
|
||||||
});
|
});
|
||||||
|
|
||||||
http_thread = std::thread(
|
http_thread = std::thread(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user