HttpClient.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2021-11-03 14:08:44
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2021-11-15 14:52:38
  8. */
  9. #pragma once
  10. #include <iostream>
  11. #include <time.h>
  12. #include <ctime>
  13. #include "Util/logger.h"
  14. #include "Util/NoticeCenter.h"
  15. #include "Poller/EventPoller.h"
  16. #include "Player/PlayerProxy.h"
  17. #include "Rtmp/RtmpPusher.h"
  18. #include "Common/config.h"
  19. #include "Pusher/MediaPusher.h"
  20. #include "Extension/Frame.h"
  21. #include "Util/SqlPool.h"
  22. #include "Network/TcpClient.h"
  23. #include "Poller/Timer.h"
  24. #include "TCPClient.h"
  25. #include "inifile.h"
  26. #include "Notices.h"
  27. #include "md5.h"
  28. #include "NettyHttpResultMsg.h"
  29. #include "NettyHttpToken.h"
  30. #include "NettyHttpNull.h"
  31. #include "NettyHttpCarInfo.h"
  32. #include "NettyHttpPeakValleyConfig.h"
  33. #include "NettyHttpCrowdingDegreeConfig.h"
  34. using namespace std;
  35. namespace MIVA
  36. {
  37. class HttpClient
  38. {
  39. private:
  40. // 用户名
  41. std::string account;
  42. std::string pwd = "sunwin20211102";
  43. // 固定16位私钥
  44. std::string privateKey = "mwWAH2eUAAHodlRt";
  45. // authToken
  46. std::string authToken = "";
  47. // refreshToken
  48. std::string refreshToken = "";
  49. public:
  50. HttpClient();
  51. ~HttpClient();
  52. /**
  53. * @description: 初始化
  54. * @param {string} account
  55. * @param {string} url
  56. * @param {int} port
  57. * @return {*}
  58. */
  59. int32_t Init(std::string account,std::string url, int port);
  60. /**
  61. * @description: 创建对象
  62. * @param {*}
  63. * @return {*}
  64. */
  65. static std::shared_ptr<HttpClient> CreateNew();
  66. /**
  67. * @description: 登录
  68. * @param {*}
  69. * @return {*}
  70. */
  71. int32_t LoginNetty();
  72. /**
  73. * @description: 获取用户数据
  74. * @param {*}
  75. * @return {*}
  76. */
  77. int32_t GetUserData();
  78. /**
  79. * @description: 获取峰谷配置列表
  80. * @param {*}
  81. * @return {*}
  82. */
  83. int32_t GetPeakValleyConfig();
  84. /**
  85. * @description: 获取拥挤配置
  86. * @param {*}
  87. * @return {*}
  88. */
  89. int32_t GetCrowdingDegreeConfig();
  90. /**
  91. * @description: 获取时间
  92. * @param {char} *ctime
  93. * @return {*}
  94. */
  95. static void getDataTime(char *ctime);
  96. /**
  97. * @description: 判断是否获取到Token
  98. * @param {*}
  99. * @return {*}
  100. */
  101. bool alive();
  102. };
  103. } // namespace name