http.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. package server
  2. import (
  3. "city_chips/internal/handler"
  4. "city_chips/internal/middleware"
  5. "city_chips/pkg/log"
  6. "github.com/gin-gonic/gin"
  7. )
  8. func NewServerHTTP(
  9. logger *log.Logger,
  10. accessHandler *handler.AccessControlHandler,
  11. hikvision *handler.HikvisionHandler,
  12. conference *handler.ConferenceHandler,
  13. home *handler.HomeHandler,
  14. elevator *handler.ElevatorHandler,
  15. broadcast *handler.BroadcastHandler,
  16. property *handler.PropertyHandler,
  17. information *handler.InformationHandler,
  18. illuminating *handler.IlluminatingHandler,
  19. energy *handler.EnergyHandler,
  20. intell *handler.IntelligentBuildingControlHandler,
  21. tempers *handler.TemperatureHandler,
  22. ) *gin.Engine {
  23. gin.SetMode(gin.ReleaseMode)
  24. r := gin.Default()
  25. r.Use(
  26. middleware.CORSMiddleware(),
  27. )
  28. // 使用 HTTP/2 必须启用 HTTPS
  29. //r.RunTLS(":443", "cert.pem", "key.pem")
  30. r.LoadHTMLGlob("templates/h5player.html")
  31. r.Static("/static", "./templates/static")
  32. //出入口控制系统
  33. Access := r.Group("/Access")
  34. {
  35. Access.GET("/count", accessHandler.GetAccessControl)
  36. Access.GET("/getParkingLotInfo", accessHandler.GetParkingLotInfo)
  37. Access.GET("/getDriveway", accessHandler.GetDriveway)
  38. }
  39. //海康威视
  40. Hikvision := r.Group("/Hikvision")
  41. {
  42. Hikvision.GET("/getMonitoring", hikvision.GetHikvisionMonitoring)
  43. Hikvision.GET("/controlling", hikvision.Gimbalcontrol)
  44. Hikvision.GET("/visitorInfo", hikvision.VisitorInfoCount)
  45. Hikvision.GET("/monitor", hikvision.GetMonitor)
  46. Hikvision.GET("/invade", hikvision.GetInvade)
  47. Hikvision.GET("/endpoint", hikvision.GetElectronicInspections)
  48. Hikvision.GET("/visitor", hikvision.GetVisitor)
  49. Hikvision.GET("/passenger", hikvision.GetPassenger)
  50. Hikvision.GET("/access", hikvision.GetAccess)
  51. Hikvision.GET("/getDoorSearch", hikvision.GetDoorSearch)
  52. Hikvision.GET("/doControl", hikvision.DoControl)
  53. Hikvision.GET("/eventLogs", hikvision.RealTimeInspection)
  54. Hikvision.GET("/getPatrolPoint", hikvision.GetPatrolPoint)
  55. Hikvision.GET("/getCameraSearch", hikvision.GetCameraSearch)
  56. Hikvision.GET("/getCameraList", hikvision.GetCameraList)
  57. Hikvision.GET("/getAcsDeviceSearch", hikvision.GetAcsDeviceSearch)
  58. Hikvision.GET("/getDoorStates", hikvision.GetDoorStates)
  59. Hikvision.GET("/getDoorDoControl", hikvision.GetDoorDoControl)
  60. Hikvision.GET("/getAcsDoorStates", hikvision.GetAcsDoorStates)
  61. }
  62. //会议系统
  63. Conference := r.Group("/Conference")
  64. {
  65. Conference.GET("/roomOps", conference.RoomOps)
  66. Conference.GET("/dataAnalysis", conference.DataAnalysis)
  67. Conference.GET("/getRoomsByLocationId", conference.GetRoomsByLocationId)
  68. Conference.POST("/getRoomsByLocation", conference.GetRoomsByLocation)
  69. Conference.GET("/meetingRoomById", conference.MeetingRoomById)
  70. Conference.GET("/location", conference.Location)
  71. Conference.GET("/meeting", conference.GetRoomsMeeting)
  72. }
  73. //首页数据
  74. h := r.Group("/Home")
  75. {
  76. h.GET("/count", home.GetHome)
  77. }
  78. //电梯控制系统
  79. el := r.Group("/elevator")
  80. {
  81. el.GET("/count", elevator.GetElevator)
  82. el.GET("/elevatorData", elevator.GetElevatorData)
  83. }
  84. //广播控制系统
  85. bro := r.Group("/broadcast")
  86. {
  87. bro.GET("/count", broadcast.GetBroadcast)
  88. bro.GET("/getBroadcast", broadcast.GetBroadcastState)
  89. }
  90. //物业管理系统
  91. pro := r.Group("/property")
  92. {
  93. pro.GET("/count", property.GetProperty)
  94. }
  95. //信息发布管理平台
  96. info := r.Group("/information")
  97. {
  98. info.GET("/count", information.GetInformation)
  99. }
  100. //照明系统
  101. ill := r.Group("/illuminating")
  102. {
  103. ill.GET("/count", illuminating.GetIlluminating)
  104. ill.GET("/getLightingstatus", illuminating.GetLightingstatus)
  105. ill.POST("/updateLightingStatus", illuminating.UpdataLightingStatus)
  106. ill.GET("/getStatistics", illuminating.GetStatistics)
  107. ill.POST("/getBaseecic", illuminating.GetBaseecic)
  108. ill.GET("/gatewayFind", illuminating.GetgatewayFind)
  109. ill.POST("/devicesControl", illuminating.DevicesControl)
  110. ill.GET("/getDeviceOrgid", illuminating.GetDeviceOrgid)
  111. ill.GET("/getBuildingRegionRoomTree", illuminating.GetBuildingRegionRoomTree)
  112. ill.GET("/categoryPart", illuminating.CategoryPart)
  113. ill.GET("/deviceAllMini", illuminating.DeviceAllMini)
  114. ill.POST("/timingSave", illuminating.TimingSave)
  115. ill.GET("/changeState", illuminating.ChangeState)
  116. ill.GET("/getTypeFind", illuminating.GetTypeFind)
  117. ill.GET("/getTimingId", illuminating.GetTimingId)
  118. }
  119. //能源系统
  120. ener := r.Group("/energy")
  121. {
  122. ener.GET("/count", energy.GetEnergy)
  123. ener.GET("/GetWaterMmeter", energy.GetWaterMmeter)
  124. ener.GET("/getAmmeter", energy.GetAmmeter)
  125. ener.GET("/getTemperature", energy.GetTemperature)
  126. ener.POST("/getBaseecic", energy.GetBaseecic)
  127. ener.GET("/gatewayFind", energy.GetgatewayFind)
  128. ener.POST("/getEnergyTrend", energy.GetEnergyTrend)
  129. ener.GET("/categoryStatistics", energy.CategoryStatistics)
  130. ener.GET("/getHisData", energy.GetHisData)
  131. }
  132. //楼宇智控
  133. inte := r.Group("/intell")
  134. {
  135. inte.GET("/count", intell.GetIntelligentBuildingControl)
  136. inte.POST("/point", intell.GetPoint)
  137. inte.GET("/pointSSE", intell.GetGetPointSSE)
  138. inte.GET("/pointType", intell.GetPointType)
  139. inte.GET("/deviceType", intell.GetDeviceType)
  140. }
  141. //温控
  142. temper := r.Group("/temperature")
  143. {
  144. temper.GET("/count", tempers.GetTemperature)
  145. temper.POST("/getBaseecic", tempers.GetBaseecic)
  146. temper.GET("/gatewayFind", tempers.GetgatewayFind)
  147. temper.GET("/getTemperatureInfo", tempers.GetTemperatureInfo)
  148. }
  149. return r
  150. }