| | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "github.com/gin-gonic/gin" |
| | | "strconv" |
| | | "webserver/extend/code" |
| | | "basic.com/valib/logger.git" |
| | | "webserver/extend/util" |
| | | ) |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | // @Summary 根据摄像机id和任务id查询算法配置详情 |
| | | // @Description 根据摄像机id和任务id查询算法配置详情 |
| | | // @Produce json |
| | | // @Tags CameraTaskArgs |
| | | // @Param cameraId query string true "摄像机id" |
| | | // @Param taskId query string true "任务id" |
| | | // @Param set_type query string true "任务类型" |
| | | // @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/getRulesByCameraAndTask [get] |
| | | func (controller CameraTaskArgsController) FindByCameraAndTask(c *gin.Context) { |
| | | cameraId := c.Query("cameraId") |
| | | taskId := c.Query("taskId") |
| | |
| | | } |
| | | } |
| | | |
| | | // @Summary 根据多个摄像机id查询联动任务规则设置 |
| | | // @Description 根据多个摄像机id查询联动任务规则设置 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags CameraTaskArgs |
| | | // @Param cameraIds body controllers.MultiCamera true "摄像机ids" |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | | // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" |
| | | // @Router /data/api-v/cameraTaskArgs/getLinkRulesByCameraIds [get] |
| | | func (controller CameraTaskArgsController) GetLinkRulesByCameraIds(c *gin.Context) { |
| | | var cameraIds MultiCamera |
| | | if err := c.BindJSON(&cameraIds);err !=nil { |
| | | var cameraIdsVo MultiCamera |
| | | if err := c.BindJSON(&cameraIdsVo);err !=nil { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | return |
| | | } |
| | | var api dbapi.CameraTaskArgsApi |
| | | flag,data := api.GetLinkRulesByCameraIds() |
| | | paramBody := util.Struct2Map(cameraIdsVo) |
| | | flag,data := api.GetLinkRulesByCameraIds(paramBody) |
| | | if flag { |
| | | util.ResponseFormat(c,code.Success,data) |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // @SUmmary 根据分组id删除摄像机算法规则 |
| | | // @Description 根据分组id删除摄像机算法规则 |
| | | // @Produce json |
| | | // @Tags CameraTaskArgs |
| | | // @Param groupId query 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/cameraTaskArgs/deleteByGroup [get] |
| | | func (controller CameraTaskArgsController) UpdateDefenceStateByGroup(c *gin.Context){ |
| | | groupId := c.PostForm("groupId") |
| | | str := c.PostForm("defenceState") |
| | | logger.Debug("defenceState:",str) |
| | | defenceState, err := strconv.ParseBool(str) |
| | | if groupId =="" || err !=nil{ |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var api dbapi.CameraTaskArgsApi |
| | | if b,data := api.UpdateDefenceStateByGroup(groupId,defenceState);b{ |
| | | util.ResponseFormat(c,code.UpdateSuccess,data) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,data) |
| | | } |
| | | } |
| | | |
| | | func (controller CameraTaskArgsController)DeleteByGroup(c *gin.Context) { |
| | | groupId := c.Query("groupId") |
| | | if groupId == "" { |
| | |
| | | return |
| | | } |
| | | var api dbapi.CameraTaskArgsApi |
| | | flag,data:=api.DeleteByGroup(groupId) |
| | | flag,data := api.DeleteByGroup(groupId) |
| | | if flag { |
| | | util.ResponseFormat(c,code.Success,data) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,data) |
| | | util.ResponseFormat(c,code.ComError,"删除失败") |
| | | } |
| | | |
| | | } |
| | |
| | | GroupId string `json:"group_id"`//分组id |
| | | } |
| | | |
| | | // @Summary 保存联动任务规则参数 |
| | | // @Description 保存联动任务规则参数 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Param saveBody body controllers.SaveLinkRulesGroupVo true "联动任务规则保存参数" |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | | // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" |
| | | // @Router /data/api-v/cameraTaskArgs/saveLinkRulesByGroup [post] |
| | | func (controller CameraTaskArgsController) SaveLinkRulesByGroup(c *gin.Context) { |
| | | var saveBody SaveLinkRulesGroupVo |
| | | if err := c.BindJSON(&saveBody);err !=nil { |