12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef WEBAPIBASE_H
- #define WEBAPIBASE_H
- #include <QString>
- #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<spdlog::logger> m_logger = nullptr;
- lhhttpapi* m_httpApi = nullptr;
- QString m_userToken;
- };
- #endif /* WEBAPIBASE_H */
|