#ifndef WEBAPIBASE_H #define WEBAPIBASE_H #include #include "spdlog/spdlog.h" class lhhttpapi; #define nJsonCatch catch(const nJson::parse_error& e) \ { \ mCritical << "WebAPI parse failed: " << e.what();\ return false;\ }\ catch(const nJson::type_error& e) \ {\ mCritical << "WebAPI type failed: " << e.what();\ return false;\ }catch (const std::exception& e)\ {\ mCritical << "WebAPI std failed: " << e.what();\ return false;\ }catch(...)\ {\ mCritical << "WebAPI Operated failed: unknown error";\ return false;\ } class WebAPIBase { public: WebAPIBase(); virtual ~WebAPIBase(); /* 初始化WebAPI */ bool initWebApi(const QString& url, const QString& serID, const QString appType, const QString serverIP = ""); private: std::shared_ptr m_logger = nullptr; lhhttpapi* m_httpApi = nullptr; QString m_userToken; }; #endif /* WEBAPIBASE_H */