WebAPIBase.h 659 B

1234567891011121314151617181920212223242526272829
  1. #ifndef _WEBAPIBASE_H_
  2. #define _WEBAPIBASE_H_
  3. #include "lhhttpapi.h"
  4. #include "commonDefine.h"
  5. class WebAPIBase
  6. {
  7. public:
  8. WebAPIBase() = default;
  9. virtual ~WebAPIBase();
  10. /* 初始化WebAPI */
  11. virtual bool initWebApi(const QString& url, const QString& serID, const QString appType, const QString& serverIP = "");
  12. protected:
  13. /* 将json的key转换成小写 */
  14. bool convertJsonKeyToLower(const nJson& json, nJson& result);
  15. /* 打印webapi返回的错误信息 */
  16. void printWebApiError(int ret, const QString& errorMsg);
  17. protected:
  18. lhhttpapi* m_httpApi = nullptr;
  19. QString m_userToken;
  20. };
  21. #endif /* _WEBAPIBASE_H_ */