| | |
| | | } |
| | | } |
| | | |
| | | type CameraChangeRunVo struct { |
| | | CameraIds []string `json:"camera_ids"` |
| | | RunType int `json:"run_type"` |
| | | } |
| | | |
| | | // @Summary 摄像机轮询和实时状态切换 |
| | | // @Description 摄像机轮询和实时状态切换 |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param cameraId query string true "摄像机id" |
| | | // @Param runType query int true "0:实时切轮询,1:轮询切实时" |
| | | // @Param changeRunBody body controllers.CameraChangeRunVo true "参数结构体,0:实时切轮询,1:轮询切实时" |
| | | // @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/changeRunType [post] |
| | | func (cc CameraController) ChangeRunType(c *gin.Context){ |
| | | cameraId := c.PostForm("cameraId") |
| | | runTypeStr := c.PostForm("runType") |
| | | runType,err := strconv.Atoi(runTypeStr) |
| | | if cameraId == "" || err!=nil || (runType !=0 && runType !=1){ |
| | | var ccrVo CameraChangeRunVo |
| | | if err := c.BindJSON(&ccrVo);err !=nil{ |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | return |
| | | } |
| | | |
| | | paramBody := util.Struct2Map(ccrVo) |
| | | var api dbapi.CameraApi |
| | | b, data := api.ChangeRunType(cameraId, runType) |
| | | b, data := api.ChangeRunType(paramBody) |
| | | if b { |
| | | util.ResponseFormat(c,code.Success,data) |
| | | } else { |