554325746@qq.com
2020-02-17 045ca3200a757e368df9c6f2b043e687710a2ed1
add GetServerName and UpdateCameraArea
7个文件已修改
73 ■■■■■ 已修改文件
controllers/camera.go 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/sdk.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
extend/config/config.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.mod 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.sum 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
middlewares/auth/auth.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/camera.go
@@ -203,18 +203,27 @@
// @Security ApiKeyAuth
// @Summary 将摄像机挂到指定的目录树下
// @Description 将摄像机挂到指定的目录树下
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags camera
// @Param cameraId path string true "摄像机id"
// @Param areaId path string true "目录区域id"
// @Param cameraId formData string true "摄像机id"
// @Param areaId formData string true "目录区域id"
// @Success 200 {string} json "{"code":200, success:true, msg:"请求处理成功", data:""}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:"错误信息内容"}"
// @Router /data/api-v/camera/cameraAreaAdd [get]
func (ac CameraController) CameraAreaAdd(c *gin.Context) {
    cameraId := c.Param("cameraId")
    areaId := c.Param("areaId")
    fmt.Println(cameraId)
    fmt.Println(areaId)
// @Router /data/api-v/camera/updateCameraArea [post]
func (ac CameraController) UpdateCameraArea(c *gin.Context) {
    cameraId := c.PostForm("cameraId")
    areaId := c.PostForm("areaId")
    if cameraId == "" || areaId == "" {
        util.ResponseFormat(c, code.RequestParamError, "参数有误")
        return
    }
    var api dbapi.CameraApi
    if api.UpdateCameraArea(cameraId, areaId) {
        util.ResponseFormat(c,code.Success,"更新成功")
    } else {
        util.ResponseFormat(c,code.ComError,"")
    }
}
// @Security ApiKeyAuth
controllers/sdk.go
@@ -59,7 +59,7 @@
        return
    }
    paramBody := util.Struct2Map(sdk)
    flag, data := api.Save(paramBody)
    flag, data := api.Register(paramBody)
    if flag {
        util.ResponseFormat(c, code.Success, data)
    } else {
extend/config/config.go
@@ -11,6 +11,7 @@
    Color string `mapstructure: "color"`
}
type server struct {
    ServerName     string `mapstructure: "serverName"`
    Runmode        string `mapstructure: "runmode"`
    JwtSecret      string `mapstructure: "jwtSecret"`
    JwtExpire      string `mapstructure: "jwtExpire"`
go.mod
@@ -3,18 +3,19 @@
go 1.12
require (
    basic.com/dbapi.git v0.0.0-20191224083228-8018a323ebc3 // indirect
    basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb // indirect
    basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b // indirect
    basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 // indirect
    basic.com/pubsub/esutil.git v0.0.0-20200114073900-ad9de8362777 // indirect
    basic.com/pubsub/protomsg.git v0.0.0-20191223033758-3fd9a59b8137 // indirect
    basic.com/valib/capture.git v0.0.0-20191204103802-89c923cf2abe // indirect
    basic.com/dbapi.git v0.0.0-20200217060017-7b7936eccf58
    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-20200114073900-ad9de8362777
    basic.com/pubsub/protomsg.git v0.0.0-20200214063013-5af26f4a46cd
    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 // indirect
    basic.com/valib/goffmpeg.git v0.0.0-20191206044626-489734b189f9 // indirect
    basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28 // indirect
    basic.com/valib/logger.git v0.0.0-20190928113028-4907b08c4159 // indirect
    basic.com/valib/gogpu.git v0.0.0-20190711044327-62043b070865
    basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28
    basic.com/valib/logger.git v0.0.0-20190928113028-4907b08c4159
    github.com/Microsoft/go-winio v0.4.12 // indirect
    github.com/ajg/form v1.5.1 // indirect
    github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
@@ -31,6 +32,7 @@
    github.com/pkg/errors v0.8.1
    github.com/robfig/cron v1.2.0
    github.com/satori/go.uuid v1.2.0
    github.com/shirou/gopsutil v2.20.1+incompatible
    github.com/spf13/viper v1.4.0
    github.com/swaggo/gin-swagger v1.1.0
    github.com/swaggo/swag v1.4.0
go.sum
@@ -1,5 +1,5 @@
basic.com/dbapi.git v0.0.0-20191224083228-8018a323ebc3 h1:sW+KVl8NguOKbafPou8uNoEBHRcmiKM1lIqB45jucFc=
basic.com/dbapi.git v0.0.0-20191224083228-8018a323ebc3/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q=
basic.com/dbapi.git v0.0.0-20200217060017-7b7936eccf58 h1:gs968zdAMNIcTTs50FWtu2hhfptxWYOmJj0w6h+HKec=
basic.com/dbapi.git v0.0.0-20200217060017-7b7936eccf58/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q=
basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb h1:fM6DojeInFSCFO+wkba1jtyPiSDqw0jYKi4Tk+e+ka4=
basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb/go.mod h1:FTryK8BsVLfUplx8a3+l8hJWub6VbAWZCUH7sPRZaso=
basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b h1:Qh7x2PY3HA9B404Llq+olY5/YlGYrM58bpOHa2CGcro=
@@ -8,8 +8,10 @@
basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48/go.mod h1:gHLJZz2ee1cGL0X0ae69fs56bAxkDgEQwDhhXZJNUcY=
basic.com/pubsub/esutil.git v0.0.0-20191120125514-865efa73a9ae h1:/j1dIDLxzEp51N+ZHZIq1xeYVK9zz8epWEAfw01uWe8=
basic.com/pubsub/esutil.git v0.0.0-20191120125514-865efa73a9ae/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw=
basic.com/pubsub/protomsg.git v0.0.0-20191223033758-3fd9a59b8137 h1:bvAnC34X/0CjLcubBj2sfHKzYXZXDjnd0LD7pyp1pH0=
basic.com/pubsub/protomsg.git v0.0.0-20191223033758-3fd9a59b8137/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU=
basic.com/pubsub/esutil.git v0.0.0-20200114073900-ad9de8362777 h1:gTeuhepfLgOchD6bqydsGGV6KCj/UaseQQgo4DFyhGQ=
basic.com/pubsub/esutil.git v0.0.0-20200114073900-ad9de8362777/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw=
basic.com/pubsub/protomsg.git v0.0.0-20200214063013-5af26f4a46cd h1:6Ce0UY1ZMmQKew7Xux6Rd10Tp5JK8WNF4UzdnFlfUWM=
basic.com/pubsub/protomsg.git v0.0.0-20200214063013-5af26f4a46cd/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=
@@ -17,6 +19,8 @@
basic.com/valib/godraw.git v0.0.0-20191122082247-26e9987cd183/go.mod h1:LntbWczdG87utrKx7rWYmIh1VZ+X2oPN7Q2IXb6oRE0=
basic.com/valib/goffmpeg.git v0.0.0-20191206044626-489734b189f9 h1:19dMiCVly4byHQzBSNYC038R0ehose+funLPZmKO3UY=
basic.com/valib/goffmpeg.git v0.0.0-20191206044626-489734b189f9/go.mod h1:1x75Hawh/BjgPsQtuJ24px89gzk3uAslD8e0Xs6Z7GQ=
basic.com/valib/gogpu.git v0.0.0-20190711044327-62043b070865 h1:3XvkNdRlJDXV45ie8U0uGA9ImJZtyTT0C/h+4Rizv0Y=
basic.com/valib/gogpu.git v0.0.0-20190711044327-62043b070865/go.mod h1:yxux5RP4A6a591vWljXxGlHdERVVyWDD3TwwQjuyogw=
basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28 h1:3hejanzPEBvZSSvjIqayB83/6/6SLLrX9oNZAdiYELg=
basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28/go.mod h1:CQ+UJyZV8MRzwwckncdUDu6/RDTKAzSIPCxc9tFcwPs=
basic.com/valib/logger.git v0.0.0-20190928113028-4907b08c4159 h1:e5KopUEW/E9qmE3gUS6m7uO+/ti/N2m8rMMHB/HVqPk=
@@ -239,6 +243,8 @@
github.com/schollz/progressbar/v2 v2.12.1/go.mod h1:fBI3onORwtNtwCWJHsrXtjE3QnJOtqIZrvr3rDaF7L0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil v2.20.1+incompatible h1:oIq9Cq4i84Hk8uQAUOG3eNdI/29hBawGrD5YRl6JRDY=
github.com/shirou/gopsutil v2.20.1+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
middlewares/auth/auth.go
@@ -56,7 +56,7 @@
    return func(c *gin.Context) {
        urlPath := c.Request.URL.Path
        if strings.Contains(urlPath,"/data/api-") && !strings.Contains(urlPath,"login") && !strings.Contains(urlPath, "/data/api-v/license"){
        if strings.Contains(urlPath,"/data/api-") && !strings.Contains(urlPath,"login") && !strings.Contains(urlPath, "/data/api-v/license") && !strings.Contains(urlPath, "/data/api-v/info/"){
            jwtDriver :=NewJwtAuthDriver()
            if !jwtDriver.Check(c) {
                util.ResponseFormat(c,code.TokenNotFound,"尚未登录,请登录")
@@ -84,4 +84,4 @@
func GetCurUser(c *gin.Context)map[string]interface{}{
    return (*GenerateAuthDriver()).User(c)
}
}
router/router.go
@@ -45,6 +45,7 @@
    licenseController := new(controllers.LicenseController)
    fileAnalysisC := new(controllers.FileAnalysisController)
    fileSettingC := new(controllers.FileAnalysisSettingController)
    icController := new(controllers.InfoController)
    urlPrefix := "/data/api-v" // wp 添加 路径 前缀
@@ -98,6 +99,7 @@
        camera.PUT("/update", cameraController.CameraUpdate)
        camera.DELETE("/del/:cid", cameraController.CameraDel)
        camera.GET("/show/:cid", cameraController.CameraSel)
        camera.POST("/updateCameraArea", cameraController.UpdateCameraArea)
        camera.GET("/updateSnapshotUrl/:cid", cameraController.UpdateSnapshotUrl)
        camera.POST("/alltask", cameraTaskController.FindTasksByCameraIds)
@@ -247,6 +249,11 @@
        vsset.POST("/upgrade", ssController.Upgrade)
    }
    ic := r.Group(urlPrefix + "/info")
    {
        ic.GET("/getServerName", icController.GetServerName)
    }
    //算法库操作
    sdkApi := r.Group(urlPrefix + "/sdk")
    {