| | |
| | | "encoding/json" |
| | | "fmt" |
| | | "strconv" |
| | | "webserver/extend/logger" |
| | | "basic.com/valib/logger.git" |
| | | |
| | | "github.com/gin-gonic/gin" |
| | | |
| | |
| | | type CameraVo struct { |
| | | Id string `json:"id"` |
| | | Name string `json:"name"` |
| | | Alias string `json:"alias"` //摄像机的别名 |
| | | Type int `json:"type" ` |
| | | Addr string `json:"addr"` |
| | | Areaid uint `json:"areaid"` |
| | | Longitude float64 `json:"longitude"` |
| | | Latitude float64 `json:"latitude"` |
| | | Areaid string `json:"areaid"` |
| | | Longitude float32 `json:"longitude"` |
| | | Latitude float32 `json:"latitude"` |
| | | Rtsp string `json:"rtsp"` |
| | | Ip string `json:"ip"` |
| | | Port int `json:"port"` |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数错误") |
| | | return |
| | | } |
| | | cam.Id = util.PseudoUuid() |
| | | paramBody := util.Struct2Map(cam) |
| | | if api.CameraAdd(paramBody) { |
| | | util.ResponseFormat(c, code.Success, cam) |
| | | b, data := api.CameraAdd(paramBody) |
| | | if b { |
| | | util.ResponseFormat(c, code.Success, data) |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.ComError, err) |
| | |
| | | // @Router /data/api-v/camera/updateSnapshotUrl/{cid} [get] |
| | | func(cc CameraController) UpdateSnapshotUrl(c *gin.Context){ |
| | | cid := c.Param("cid") |
| | | filename, err := service.UpdateSnapshotUrl(cid) |
| | | //filename, err := service.UpdateSnapshotUrl(cid) |
| | | filename, err := service.UpdateCapture(cid) |
| | | if err != nil { |
| | | logger.Debug("UpdateSnapshotUrl.err:",err) |
| | | util.ResponseFormat(c, code.ComError, "更新失败") |
| | | return |
| | | } |