New file |
| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "basic.com/pubsub/esutil.git" |
| | | "basic.com/valib/logger.git" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | "webserver/cache" |
| | | "webserver/extend/code" |
| | | "webserver/extend/config" |
| | | "webserver/extend/util" |
| | | ) |
| | | |
| | | type Buckers struct { |
| | | } |
| | | |
| | | func (b *Buckers) GetBuckets(c *gin.Context) { |
| | | var info interface{} |
| | | localConf, err := cache.GetServerInfo() |
| | | if err != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | util.ResponseFormat(c, code.ComError, "es config err") |
| | | return |
| | | } |
| | | ip := localConf.AlarmIp |
| | | port := strconv.Itoa(int(localConf.AlarmPort)) |
| | | c.BindJSON(&info) |
| | | inf := info.(map[string]interface{}) |
| | | startTime := inf["startTime"].(string) |
| | | endTime := inf["endTime"].(string) |
| | | cameraId := inf["cameraId"].([]string) |
| | | thresholdTime := inf["thresholdTime"].(float64) |
| | | resDate, err := esutil.GetfaceDataBucketsBycameraIdAndTime(cameraId, startTime, endTime, thresholdTime, ip, port, config.EsInfo.EsIndex.AiOcean.IndexName) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.FailedQuery, err) |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, resDate) |
| | | } |
| | |
| | | // Success 请求处理成功 |
| | | Success = &Code{http.StatusOK, true, "请求处理成功"} |
| | | AddSuccess = &Code{http.StatusOK, true, "添加成功"} |
| | | UploadSuccess = &Code{ http.StatusOK, true, "上传成功"} |
| | | UploadSuccess = &Code{http.StatusOK, true, "上传成功"} |
| | | UpdateSuccess = &Code{http.StatusOK, true, "更新成功"} |
| | | UpdateFail = &Code{http.StatusBadRequest, false, "更新失败"} |
| | | DelSuccess = &Code{http.StatusOK, true, "删除成功"} |
| | |
| | | |
| | | UpgradeSuccess = &Code{http.StatusOK, true, "升级成功"} |
| | | UpgradeFail = &Code{http.StatusInternalServerError, false, "升级失败"} |
| | | FailedQuery = &Code{http.StatusInternalServerError, false, "查询失败"} |
| | | ) |
| | |
| | | go 1.12 |
| | | |
| | | require ( |
| | | basic.com/dbapi.git v0.0.0-20200715075404-9f0063dfc00a // indirect |
| | | basic.com/dbapi.git v0.0.0-20200715075404-9f0063dfc00a |
| | | basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb |
| | | basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 |
| | | basic.com/pubsub/esutil.git v0.0.0-20200813034025-4381bc23ecea // indirect |
| | | basic.com/pubsub/protomsg.git v0.0.0-20200717053920-8abba8d57185 // indirect |
| | | basic.com/pubsub/esutil.git v0.0.0-20200820115648-7b6d324ced5d |
| | | basic.com/pubsub/protomsg.git v0.0.0-20200817095805-2c13b42d4039 |
| | | basic.com/valib/capture.git v0.0.0-20191204103802-89c923cf2abe |
| | | basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051 |
| | | basic.com/valib/godraw.git v0.0.0-20191122082247-26e9987cd183 |
| | | basic.com/valib/goffmpeg.git v0.0.0-20200724102857-f93ee1a42e8c // indirect |
| | | basic.com/valib/gogpu.git v0.0.0-20190711044327-62043b070865 |
| | | basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28 |
| | | basic.com/valib/licence.git v2.0.2+incompatible // indirect |
| | | basic.com/valib/licence.git v2.0.2+incompatible |
| | | basic.com/valib/logger.git v0.0.0-20190928113028-4907b08c4159 |
| | | github.com/Microsoft/go-winio v0.4.12 // indirect |
| | | github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect |
| | |
| | | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc |
| | | github.com/dgrijalva/jwt-go v3.2.0+incompatible |
| | | github.com/disintegration/imaging v1.6.2 // indirect |
| | | github.com/dustin/go-humanize v1.0.0 // indirect |
| | | github.com/dustin/go-humanize v1.0.0 |
| | | github.com/gin-gonic/gin v1.4.0 |
| | | github.com/go-ole/go-ole v1.2.4 // indirect |
| | | github.com/gogo/protobuf v1.2.1 |
| | |
| | | basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b/go.mod h1:iKnzuRRqUEgt17894pX3oYcOG2fLYFVcXiZbPoMK7+4= |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 h1:BBA30Rgljn6MRieC4gUncETJDyna3ObyubTo9HEQ2M0= |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48/go.mod h1:gHLJZz2ee1cGL0X0ae69fs56bAxkDgEQwDhhXZJNUcY= |
| | | basic.com/pubsub/esutil.git v0.0.0-20200813034025-4381bc23ecea h1:WxIUobIl69Pc59XjQcIvsAUaSMbOPjDOIrD4NN97VBQ= |
| | | basic.com/pubsub/esutil.git v0.0.0-20200813034025-4381bc23ecea/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20200717053920-8abba8d57185 h1:+VNHJFYU7Y3fYP7nWC3r/1FOGZIo/rVG+RmClqbAW1k= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20200717053920-8abba8d57185/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/pubsub/esutil.git v0.0.0-20200820114117-66d9e889d745/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= |
| | | basic.com/pubsub/esutil.git v0.0.0-20200820115648-7b6d324ced5d h1:8Q4LZypFfm1SD79yxueXxrM5HmGlQBo3KvwOb1vdJ+Y= |
| | | basic.com/pubsub/esutil.git v0.0.0-20200820115648-7b6d324ced5d/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20200817095805-2c13b42d4039 h1:aAx+bukj1Fo6EfzR6U8N9DRpdGP0o3fReeM/HY1nxpc= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20200817095805-2c13b42d4039/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/valib/capture.git v0.0.0-20191204103802-89c923cf2abe h1:uh3u7DuSOw6AwzvPC1EM19sw1Skks1EUJddcbHDKI9M= |
| | | basic.com/valib/capture.git v0.0.0-20191204103802-89c923cf2abe/go.mod h1:y+h7VUnoSQ3jOtf2K3twXNA8fYDfyUsifSswcyKLgNw= |
| | | basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051/go.mod h1:bkYiTUGzckyNOjAgn9rB/DOjFzwoSHJlruuWQ6hu6IY= |
| | |
| | | cloud.google.com/go v0.37.4/go.mod h1:NHPJ89PdicEuT9hdPXMROBD91xc5uRDxsMtSB16k7hw= |
| | | code.cloudfoundry.org/bytefmt v0.0.0-20180906201452-2aa6f33b730c/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc= |
| | | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= |
| | | github.com/Microsoft/go-winio v0.4.12 h1:xAfWHN1IrQ0NJ9TBC0KBZoqLjzDTr1ML+4MywiUOryc= |
| | | github.com/Microsoft/go-winio v0.4.12/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= |
| | | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= |
| | | github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4= |
| | |
| | | dbPersonCont := new(controllers.DbPersonController) |
| | | ssController := new(controllers.SysSetController) |
| | | sdkController := new(controllers.SdkController) |
| | | bucketsController := new(controllers.Buckers) |
| | | esSearchController := new(controllers.EsSearchController) |
| | | esManagementController := new(controllers.EsManagementController) |
| | | realTimeController := new(controllers.RealTimeController) |
| | |
| | | area.POST("/gb28181TreeDelete", areaController.Gb28181TreeDelete) |
| | | } |
| | | |
| | | gbApi := r.Group(urlPrefix + "/gb28181") |
| | | { |
| | | gbApi.GET("/findAreaByParentId", gb28181C.FindAreaByParentId) |
| | | gbApi.GET("/newGbId",gb28181C.NewGbId) |
| | | } |
| | | gbApi := r.Group(urlPrefix + "/gb28181") |
| | | { |
| | | gbApi.GET("/findAreaByParentId", gb28181C.FindAreaByParentId) |
| | | gbApi.GET("/newGbId", gb28181C.NewGbId) |
| | | } |
| | | |
| | | //摄像机管理 |
| | | camera := r.Group(urlPrefix + "/camera") |
| | |
| | | camera.PUT("/update", cameraController.CameraUpdate) |
| | | camera.DELETE("/del/:cid", cameraController.CameraDel) |
| | | camera.GET("/show/:cid", cameraController.CameraSel) |
| | | camera.POST("/updateCameraArea", cameraController.UpdateCameraArea) |
| | | camera.POST("/updateCameraArea", cameraController.UpdateCameraArea) |
| | | camera.GET("/updateSnapshotUrl/:cid", cameraController.UpdateSnapshotUrl) |
| | | |
| | | camera.POST("/alltask", cameraTaskController.FindTasksByCameraIds) |
| | |
| | | es.POST("/addCluster", esManagementController.AddCluster) |
| | | es.POST("/createNode", esManagementController.CreateNode) |
| | | es.POST("/updateEsHosts", esManagementController.UpdateEsHosts) |
| | | es.POST("/getBuckets", bucketsController.GetBuckets) |
| | | } |
| | | |
| | | //实时被调数据 |
| | |
| | | vsset.POST("/upgrade", ssController.Upgrade) |
| | | } |
| | | |
| | | ic := r.Group(urlPrefix + "/info") |
| | | { |
| | | ic.GET("/getServerName", icController.GetServerName) |
| | | } |
| | | ic := r.Group(urlPrefix + "/info") |
| | | { |
| | | ic.GET("/getServerName", icController.GetServerName) |
| | | } |
| | | |
| | | //算法库操作 |
| | | sdkApi := r.Group(urlPrefix + "/sdk") |
| | |
| | | { |
| | | voiceApi.GET("/findAll", voiceC.FindAll) |
| | | } |
| | | |
| | | |
| | | // 文件 上传 |
| | | r.Static("static", "./static") // 静态文件 |
| | | //外部访问swagger.json |