Browse Source

V1.2.1
1、修改了WebAPIBase

Apple 2 days ago
parent
commit
c6b79e7d25
2 changed files with 8 additions and 0 deletions
  1. 6 0
      common/WebAPI/WebAPIBase.cpp
  2. 2 0
      common/WebAPI/WebAPIBase.h

+ 6 - 0
common/WebAPI/WebAPIBase.cpp

@@ -135,4 +135,10 @@ bool WebAPIBase::convertJsonKeyToLower(const nJson& json, nJson& result)
     return true;
 }
 
+/* 打印webapi返回的错误信息 */
+void WebAPIBase::printWebApiError(int ret, const QString& errorMsg)
+{
+    SPDLOG_ERROR("WebAPI Error: {}, Error Message: {}", ret, nJson::parse(errorMsg.toStdString()).dump(4));
+}
+
 

+ 2 - 0
common/WebAPI/WebAPIBase.h

@@ -16,6 +16,8 @@ public:
 protected:
     /* 将json的key转换成小写 */
     bool convertJsonKeyToLower(const nJson& json, nJson& result);
+    /* 打印webapi返回的错误信息 */
+    void printWebApiError(int ret, const QString& errorMsg);
 
 protected:
     lhhttpapi* m_httpApi = nullptr;