http.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. ) *gin.Engine {
  22. gin.SetMode(gin.ReleaseMode)
  23. r := gin.Default()
  24. r.Use(
  25. middleware.CORSMiddleware(),
  26. )
  27. r.LoadHTMLGlob("templates/h5player.html")
  28. r.Static("/static", "./templates/static")
  29. //出入口控制系统
  30. Access := r.Group("/Access")
  31. {
  32. Access.GET("/count", accessHandler.GetAccessControl)
  33. Access.GET("/getParkingLotInfo", accessHandler.GetParkingLotInfo)
  34. }
  35. //海康威视
  36. Hikvision := r.Group("/Hikvision")
  37. {
  38. Hikvision.GET("/getMonitoring", hikvision.GetHikvisionMonitoring)
  39. Hikvision.GET("/controlling", hikvision.Gimbalcontrol)
  40. Hikvision.GET("/visitorInfo", hikvision.VisitorInfoCount)
  41. Hikvision.GET("/monitor", hikvision.GetMonitor)
  42. Hikvision.GET("/invade", hikvision.GetInvade)
  43. Hikvision.GET("/endpoint", hikvision.GetElectronicInspections)
  44. Hikvision.GET("/visitor", hikvision.GetVisitor)
  45. Hikvision.GET("/passenger", hikvision.GetPassenger)
  46. Hikvision.GET("/access", hikvision.GetAccess)
  47. Hikvision.GET("/getDoorSearch", hikvision.GetDoorSearch)
  48. Hikvision.GET("/doControl", hikvision.DoControl)
  49. Hikvision.GET("/eventLogs", hikvision.RealTimeInspection)
  50. }
  51. //会议系统
  52. Conference := r.Group("/Conference")
  53. {
  54. Conference.GET("/roomOps", conference.RoomOps)
  55. Conference.GET("/dataAnalysis", conference.DataAnalysis)
  56. Conference.GET("/getRoomsByLocationId", conference.GetRoomsByLocationId)
  57. Conference.POST("/getRoomsByLocation", conference.GetRoomsByLocation)
  58. Conference.GET("/meetingRoomById", conference.MeetingRoomById)
  59. Conference.GET("/location", conference.Location)
  60. Conference.GET("/meeting", conference.GetRoomsMeeting)
  61. }
  62. //首页数据
  63. h := r.Group("/Home")
  64. {
  65. h.GET("/count", home.GetHome)
  66. }
  67. //电梯控制系统
  68. el := r.Group("/elevator")
  69. {
  70. el.GET("/count", elevator.GetElevator)
  71. }
  72. //广播控制系统
  73. bro := r.Group("/broadcast")
  74. {
  75. bro.GET("/count", broadcast.GetBroadcast)
  76. }
  77. //物业管理系统
  78. pro := r.Group("/property")
  79. {
  80. pro.GET("/count", property.GetProperty)
  81. }
  82. //信息发布管理平台
  83. info := r.Group("/information")
  84. {
  85. info.GET("/count", information.GetInformation)
  86. }
  87. //照明系统
  88. ill := r.Group("/illuminating")
  89. {
  90. ill.GET("/count", illuminating.GetIlluminating)
  91. }
  92. //能源系统
  93. ener := r.Group("/energy")
  94. {
  95. ener.GET("/count", energy.GetEnergy)
  96. }
  97. //楼宇智控
  98. inte := r.Group("/intell")
  99. {
  100. inte.GET("/count", intell.GetIntelligentBuildingControl)
  101. }
  102. return r
  103. }