123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- package server
- import (
- "city_chips/internal/handler"
- "city_chips/internal/middleware"
- "city_chips/pkg/log"
- "github.com/gin-gonic/gin"
- )
- func NewServerHTTP(
- logger *log.Logger,
- accessHandler *handler.AccessControlHandler,
- hikvision *handler.HikvisionHandler,
- conference *handler.ConferenceHandler,
- home *handler.HomeHandler,
- elevator *handler.ElevatorHandler,
- broadcast *handler.BroadcastHandler,
- property *handler.PropertyHandler,
- information *handler.InformationHandler,
- illuminating *handler.IlluminatingHandler,
- energy *handler.EnergyHandler,
- intell *handler.IntelligentBuildingControlHandler,
- tempers *handler.TemperatureHandler,
- ) *gin.Engine {
- gin.SetMode(gin.ReleaseMode)
- r := gin.Default()
- r.Use(
- middleware.CORSMiddleware(),
- )
- // 使用 HTTP/2 必须启用 HTTPS
- //r.RunTLS(":443", "cert.pem", "key.pem")
- r.LoadHTMLGlob("templates/h5player.html")
- r.Static("/static", "./templates/static")
- //出入口控制系统
- Access := r.Group("/Access")
- {
- Access.GET("/count", accessHandler.GetAccessControl)
- Access.GET("/getParkingLotInfo", accessHandler.GetParkingLotInfo)
- Access.GET("/getDriveway", accessHandler.GetDriveway)
- }
- //海康威视
- Hikvision := r.Group("/Hikvision")
- {
- Hikvision.GET("/getMonitoring", hikvision.GetHikvisionMonitoring)
- Hikvision.GET("/controlling", hikvision.Gimbalcontrol)
- Hikvision.GET("/visitorInfo", hikvision.VisitorInfoCount)
- Hikvision.GET("/monitor", hikvision.GetMonitor)
- Hikvision.GET("/invade", hikvision.GetInvade)
- Hikvision.GET("/endpoint", hikvision.GetElectronicInspections)
- Hikvision.GET("/visitor", hikvision.GetVisitor)
- Hikvision.GET("/passenger", hikvision.GetPassenger)
- Hikvision.GET("/access", hikvision.GetAccess)
- Hikvision.GET("/getDoorSearch", hikvision.GetDoorSearch)
- Hikvision.GET("/doControl", hikvision.DoControl)
- Hikvision.GET("/eventLogs", hikvision.RealTimeInspection)
- Hikvision.GET("/getPatrolPoint", hikvision.GetPatrolPoint)
- Hikvision.GET("/getCameraSearch", hikvision.GetCameraSearch)
- Hikvision.GET("/getCameraList", hikvision.GetCameraList)
- Hikvision.GET("/getAcsDeviceSearch", hikvision.GetAcsDeviceSearch)
- Hikvision.GET("/getDoorStates", hikvision.GetDoorStates)
- Hikvision.GET("/getDoorDoControl", hikvision.GetDoorDoControl)
- Hikvision.GET("/getAcsDoorStates", hikvision.GetAcsDoorStates)
- }
- //会议系统
- Conference := r.Group("/Conference")
- {
- Conference.GET("/roomOps", conference.RoomOps)
- Conference.GET("/dataAnalysis", conference.DataAnalysis)
- Conference.GET("/getRoomsByLocationId", conference.GetRoomsByLocationId)
- Conference.POST("/getRoomsByLocation", conference.GetRoomsByLocation)
- Conference.GET("/meetingRoomById", conference.MeetingRoomById)
- Conference.GET("/location", conference.Location)
- Conference.GET("/meeting", conference.GetRoomsMeeting)
- }
- //首页数据
- h := r.Group("/Home")
- {
- h.GET("/count", home.GetHome)
- }
- //电梯控制系统
- el := r.Group("/elevator")
- {
- el.GET("/count", elevator.GetElevator)
- el.GET("/elevatorData", elevator.GetElevatorData)
- }
- //广播控制系统
- bro := r.Group("/broadcast")
- {
- bro.GET("/count", broadcast.GetBroadcast)
- bro.GET("/getBroadcast", broadcast.GetBroadcastState)
- }
- //物业管理系统
- pro := r.Group("/property")
- {
- pro.GET("/count", property.GetProperty)
- }
- //信息发布管理平台
- info := r.Group("/information")
- {
- info.GET("/count", information.GetInformation)
- }
- //照明系统
- ill := r.Group("/illuminating")
- {
- ill.GET("/count", illuminating.GetIlluminating)
- ill.GET("/getLightingstatus", illuminating.GetLightingstatus)
- ill.POST("/updateLightingStatus", illuminating.UpdataLightingStatus)
- ill.GET("/getStatistics", illuminating.GetStatistics)
- ill.POST("/getBaseecic", illuminating.GetBaseecic)
- ill.GET("/gatewayFind", illuminating.GetgatewayFind)
- ill.POST("/devicesControl", illuminating.DevicesControl)
- ill.GET("/getDeviceOrgid", illuminating.GetDeviceOrgid)
- ill.GET("/getBuildingRegionRoomTree", illuminating.GetBuildingRegionRoomTree)
- ill.GET("/categoryPart", illuminating.CategoryPart)
- ill.GET("/deviceAllMini", illuminating.DeviceAllMini)
- ill.POST("/timingSave", illuminating.TimingSave)
- ill.GET("/changeState", illuminating.ChangeState)
- ill.GET("/getTypeFind", illuminating.GetTypeFind)
- ill.GET("/getTimingId", illuminating.GetTimingId)
- }
- //能源系统
- ener := r.Group("/energy")
- {
- ener.GET("/count", energy.GetEnergy)
- ener.GET("/GetWaterMmeter", energy.GetWaterMmeter)
- ener.GET("/getAmmeter", energy.GetAmmeter)
- ener.GET("/getTemperature", energy.GetTemperature)
- ener.POST("/getBaseecic", energy.GetBaseecic)
- ener.GET("/gatewayFind", energy.GetgatewayFind)
- ener.POST("/getEnergyTrend", energy.GetEnergyTrend)
- ener.GET("/categoryStatistics", energy.CategoryStatistics)
- ener.GET("/getHisData", energy.GetHisData)
- }
- //楼宇智控
- inte := r.Group("/intell")
- {
- inte.GET("/count", intell.GetIntelligentBuildingControl)
- inte.POST("/point", intell.GetPoint)
- inte.GET("/pointSSE", intell.GetGetPointSSE)
- inte.GET("/pointType", intell.GetPointType)
- inte.GET("/deviceType", intell.GetDeviceType)
- }
- //温控
- temper := r.Group("/temperature")
- {
- temper.GET("/count", tempers.GetTemperature)
- temper.POST("/getBaseecic", tempers.GetBaseecic)
- temper.GET("/gatewayFind", tempers.GetgatewayFind)
- temper.GET("/getTemperatureInfo", tempers.GetTemperatureInfo)
- }
- return r
- }
|