http.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. ) *gin.Engine {
  21. gin.SetMode(gin.ReleaseMode)
  22. r := gin.Default()
  23. r.Use(
  24. middleware.CORSMiddleware(),
  25. )
  26. //出入口控制系统
  27. Access := r.Group("/Access")
  28. {
  29. Access.GET("/test", accessHandler.GetAccessControl)
  30. }
  31. //海康威视
  32. Hikvision := r.Group("/Hikvision")
  33. {
  34. Hikvision.GET("/getMonitoring", hikvision.GetHikvisionMonitoring)
  35. Hikvision.GET("/controlling", hikvision.Gimbalcontrol)
  36. Hikvision.GET("/visitorInfo", hikvision.VisitorInfoCount)
  37. }
  38. //会议系统
  39. Conference := r.Group("/Conference")
  40. {
  41. Conference.GET("/roomOps", conference.RoomOps)
  42. Conference.GET("/dataAnalysis", conference.DataAnalysis)
  43. Conference.GET("/getRoomsByLocationId", conference.GetRoomsByLocationId)
  44. Conference.POST("/getRoomsByLocation", conference.GetRoomsByLocation)
  45. Conference.GET("/meetingRoomById", conference.MeetingRoomById)
  46. Conference.GET("/location", conference.Location)
  47. }
  48. //首页数据
  49. h := r.Group("/Home")
  50. {
  51. h.GET("/count", home.GetHome)
  52. }
  53. //电梯控制系统
  54. el := r.Group("/elevator")
  55. {
  56. el.GET("/count", elevator.GetElevator)
  57. }
  58. //广播控制系统
  59. bro := r.Group("/broadcast")
  60. {
  61. bro.GET("/count", broadcast.GetBroadcast)
  62. }
  63. //物业管理系统
  64. pro := r.Group("/property")
  65. {
  66. pro.GET("/count", property.GetProperty)
  67. }
  68. //信息发布管理平台
  69. info := r.Group("/information")
  70. {
  71. info.GET("/count", information.GetInformation)
  72. }
  73. //照明系统
  74. ill := r.Group("/illuminating")
  75. {
  76. ill.GET("/count", illuminating.GetIlluminating)
  77. }
  78. //能源系统
  79. ener := r.Group("/energy")
  80. {
  81. ener.GET("/count", energy.GetEnergy)
  82. }
  83. return r
  84. }