GetCenter.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * @Description: 数据中心
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-04-02 13:58:46
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-06-15 11:17:29
  8. */
  9. #ifndef __GETCENTER_HPP_
  10. #define __GETCENTER_HPP_
  11. #include <iostream>
  12. #include "Util/logger.h"
  13. #include "Util/NoticeCenter.h"
  14. #include "Poller/EventPoller.h"
  15. #include "Util/SqlPool.h"
  16. #include "Network/TcpClient.h"
  17. #include "Poller/Timer.h"
  18. #include "ins_base.hpp"
  19. #include "dataTypeList.hpp"
  20. #include "requests.h"
  21. #include "axios.h"
  22. using namespace std;
  23. using namespace toolkit;
  24. using namespace hv;
  25. namespace ins{
  26. class GetCenter:public Module
  27. {
  28. private:
  29. GetCenter() : Module("GetCenter"){
  30. }
  31. public:
  32. using Ptr = std::shared_ptr<GetCenter>;
  33. ~GetCenter(){this->Destroy();}
  34. /**
  35. * @description: 初始化
  36. * @param {*}
  37. * @return {*}
  38. */
  39. int8_t Init() override;
  40. /**
  41. * @description: 释放资源
  42. * @param {*}
  43. * @return {*}
  44. */
  45. void Destroy() override;
  46. /**
  47. * @description: 创建新的实例
  48. * @param {*}
  49. * @return {*}
  50. */
  51. static std::shared_ptr<GetCenter> CreateNew();
  52. /**
  53. * @description: 获取ptr
  54. * @param {*}
  55. * @return {*}
  56. */
  57. static std::shared_ptr<GetCenter> getPtr();
  58. /**
  59. * @description: 获取KsToken
  60. * @param {*}
  61. * @return {*}
  62. */
  63. bool getKsToken();
  64. /**
  65. * @description: 分析格式
  66. * @param {string} type
  67. * @param {string} URL
  68. * @return {*}
  69. */
  70. InsDataFormat getFormat(std::string type, std::string URL);
  71. /**
  72. * @description: 获取包类型
  73. * @param {string} type
  74. * @return {*}
  75. */
  76. InsPacketTypes getPacketType(std::string type);
  77. /**
  78. * @description: 获取数据
  79. * @param {*}
  80. * @return {*}
  81. */
  82. bool getData();
  83. /**
  84. * @description:
  85. * @param {*}
  86. * @return {*}
  87. */
  88. vector<vector<std::string>> ExecuteSql(std::string& sql);
  89. /**
  90. * @description: 是否正常
  91. * @param {*}
  92. * @return {*}
  93. */
  94. bool isNormally() override{
  95. return true;
  96. }
  97. // DESCRIPTION
  98. public:
  99. Timer::Ptr timer = nullptr;
  100. };
  101. };
  102. #endif