NettyHttpCrowdingDegreeConfig.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #pragma once
  2. #include <iostream>
  3. #include <rapidjson/document.h>
  4. #include <rapidjson/rapidjson.h>
  5. #include <rapidjson/stringbuffer.h>
  6. #include <rapidjson/writer.h>
  7. #include <vector>
  8. #include "Util/logger.h"
  9. #include "Util/NoticeCenter.h"
  10. #include "Poller/EventPoller.h"
  11. #include "Player/PlayerProxy.h"
  12. #include "Rtmp/RtmpPusher.h"
  13. #include "Common/config.h"
  14. #include "Pusher/MediaPusher.h"
  15. #include "Extension/Frame.h"
  16. #include "Util/SqlPool.h"
  17. #include "Network/TcpClient.h"
  18. #include "Poller/Timer.h"
  19. using namespace std;
  20. class NettyHttpCrowdingDegreeConfig
  21. {
  22. public:
  23. std::string addTime;
  24. std::string updateTime;
  25. int createBy;
  26. int updateBy;
  27. int enableFlag;
  28. std::string attr1;
  29. std::string attr2;
  30. std::string attr3;
  31. int appId;
  32. int configId;
  33. std::string conKey;
  34. std::string conValue;
  35. std::string active;
  36. std::string remark;
  37. public:
  38. NettyHttpCrowdingDegreeConfig() {}
  39. ~NettyHttpCrowdingDegreeConfig() {}
  40. bool jsonToObject(const rapidjson::Value& object){
  41. const auto end = object.MemberEnd();
  42. if(end == object.FindMember("addTime") || !object["addTime"].IsString()){
  43. return false;
  44. }else{
  45. addTime = object["addTime"].GetString();
  46. }
  47. if(end == object.FindMember("updateTime") || !object["updateTime"].IsString()){
  48. return false;
  49. }else{
  50. updateTime = object["updateTime"].GetString();
  51. }
  52. if(end == object.FindMember("createBy") || !object["createBy"].IsInt()){
  53. return false;
  54. }else{
  55. createBy = object["createBy"].GetInt();
  56. }
  57. if(end == object.FindMember("updateBy") || !object["updateBy"].IsInt()){
  58. return false;
  59. }else{
  60. updateBy = object["updateBy"].GetInt();
  61. }
  62. if(end == object.FindMember("appId") || !object["appId"].IsInt()){
  63. return false;
  64. }else{
  65. appId = object["appId"].GetInt();
  66. }
  67. if(end == object.FindMember("configId") || !object["configId"].IsInt()){
  68. return false;
  69. }else{
  70. configId = object["configId"].GetInt();
  71. }
  72. if(end == object.FindMember("conKey") || !object["conKey"].IsString()){
  73. return false;
  74. }else{
  75. conKey = object["conKey"].GetString();
  76. }
  77. if(end == object.FindMember("conValue") || !object["conValue"].IsString()){
  78. return false;
  79. }else{
  80. conValue = object["conValue"].GetString();
  81. }
  82. return true;
  83. }
  84. /**
  85. * @description: 数据同步
  86. * @param {*}
  87. * @return {*}
  88. */
  89. bool NettyClientDataSync()
  90. {
  91. vector<vector<string>> sqlRet;
  92. SqlWriter sqlInsert("INSERT INTO MIVA_DB.SystemConfig(addTime, updateTime, createBy, updateBy, attr1, attr2, attr3, appId, configId, conKey, conValue, active, remark) VALUES(\
  93. '?','?','?','?','?','?','?','?','?','?','?','?','?' )");
  94. sqlInsert << addTime << updateTime << createBy << updateBy << attr1 << attr2 << attr3 << appId << configId << conKey << conValue << active << remark << sqlRet;
  95. return true;
  96. }
  97. };