异常抛出
This commit is contained in:
@@ -9,9 +9,10 @@
|
||||
std::string default_config_path;
|
||||
|
||||
std::string get_config_path() {
|
||||
#ifdef WIN32
|
||||
return "D:/ae/proj/projects/ECAP_Server/config/config.json";
|
||||
#endif
|
||||
// #ifdef WIN32
|
||||
// get_exe_dir()
|
||||
// return "D:/ae/proj/projects/ECAP_Server/config/config.json";
|
||||
// #endif
|
||||
static bool first = true;
|
||||
if (!default_config_path.empty())
|
||||
return default_config_path;
|
||||
@@ -55,7 +56,7 @@ void Device_Config::server(Global *g) {
|
||||
svr.Post(api + "get_net_adapter_list", [this](HTTP_Param) {
|
||||
JSON ret = JSON::object();
|
||||
auto arr = JSON::array();
|
||||
for (auto &it : Psc::get_net_adapter_info_map()) {
|
||||
for (auto &it: Psc::get_net_adapter_info_map()) {
|
||||
arr.append(it.second.to_Json());
|
||||
}
|
||||
ret.append({"list", arr});
|
||||
@@ -66,14 +67,13 @@ void Device_Config::server(Global *g) {
|
||||
CHECK_JSON_PARAM
|
||||
JSON old_device_config;
|
||||
{
|
||||
|
||||
old_device_config = to_base_json();
|
||||
}
|
||||
HTTP_REQUIRE_PTR(net, params.get("net"))
|
||||
Net_Config device, wifi;
|
||||
bool has_device = false;
|
||||
bool has_wifi = false;
|
||||
for (const auto &it : net->children) {
|
||||
for (const auto &it: net->children) {
|
||||
HTTP_REQUIRE_VALUE(net_key, it.try_get_string("key"))
|
||||
if (net_key == "device") {
|
||||
device.from_base_json(&it);
|
||||
@@ -94,7 +94,7 @@ void Device_Config::server(Global *g) {
|
||||
if (!it1 || !it2 || !p1 || !p2) {
|
||||
server_logger->error("", {},
|
||||
LOG_POS + " ip port! " + device.ip + ":" +
|
||||
std::to_string(device.port));
|
||||
std::to_string(device.port));
|
||||
res->setBody(warp(old_device_config).to_json_string());
|
||||
return;
|
||||
}
|
||||
@@ -102,10 +102,9 @@ void Device_Config::server(Global *g) {
|
||||
#if WIN32
|
||||
bool use = false;
|
||||
#else
|
||||
bool use = true;
|
||||
bool use = true;
|
||||
#endif
|
||||
{
|
||||
|
||||
auto &w = *this;
|
||||
*w.list.get("device").value() = device;
|
||||
*w.list.get("wifi").value() = wifi;
|
||||
|
||||
Reference in New Issue
Block a user