使用boost pfr 遍历结构体

This commit is contained in:
2026-06-26 09:36:14 +08:00
parent 26b5c8a54d
commit 472e609f13
17 changed files with 1322 additions and 1622 deletions
+4 -4
View File
@@ -48,7 +48,7 @@ void Device_Config::server(Global *g) {
auto &svr = g->svr;
auto &api = g->api;
svr.Post(api + "get_device_config", [this](HTTP_Param) {
res->setBody(warp(to_json()).to_json_string());
res->setBody(warp(to_base_json()).to_json_string());
});
svr.Post(api + "get_net_adapter_list", [this](HTTP_Param) {
@@ -66,7 +66,7 @@ void Device_Config::server(Global *g) {
JSON old_device_config;
{
old_device_config = to_json();
old_device_config = to_base_json();
}
HTTP_REQUIRE_PTR(net, params.get("net"))
Net_Config device, wifi;
@@ -75,11 +75,11 @@ void Device_Config::server(Global *g) {
for (const auto &it : net->children) {
HTTP_REQUIRE_VALUE(net_key, it.try_get_string("key"))
if (net_key == "device") {
device.init_from_json(&it);
device.from_base_json(&it);
has_device = true;
}
if (net_key == "wifi") {
wifi.init_from_json(&it);
wifi.from_base_json(&it);
has_wifi = true;
}
}