From 61d206e948fd9615f558917cc62a4861a66ee5d0 Mon Sep 17 00:00:00 2001 From: Sucan126 <632190820@qq.com> Date: Sun, 21 Sep 2025 15:01:32 +0800 Subject: [PATCH] =?UTF-8?q?refactor(navigation):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=86=97=E4=BD=99=E7=9A=84json=E5=80=BC=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 简化日志输出中对json值的处理,直接使用value方法获取值而不再显式调用get方法 --- src/navigation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/navigation.cpp b/src/navigation.cpp index 01559f7..38f8ff1 100644 --- a/src/navigation.cpp +++ b/src/navigation.cpp @@ -46,11 +46,11 @@ bool Navigation::callSlamService(int api_id, const nlohmann::json& data) { try { nlohmann::json response_json = nlohmann::json::parse(response_str); if (response_json.contains("succeed") && response_json["succeed"].get()) { - LOG_INFO("Slam service call for api_id " + std::to_string(api_id) + " succeeded. Info: " + response_json.value("info", "").get()); + LOG_INFO("Slam service call for api_id " + std::to_string(api_id) + " succeeded. Info: " + response_json.value("info", "")); return true; } else { LOG_ERROR("Slam service call for api_id " + std::to_string(api_id) + " failed. Error code: " + - std::to_string(response_json.value("errorCode", -1).get()) + ", Info: " + response_json.value("info", "").get()); + std::to_string(response_json.value("errorCode", -1)) + ", Info: " + response_json.value("info", "")); return false; } } catch (const nlohmann::json::parse_error& e) {