sunty
2020-08-20 9d88c7c467f8d93af4aab9ba0b6d6c01c2ffc546
controllers/cameraRule.go
@@ -2,6 +2,7 @@
import (
   "basic.com/dbapi.git"
   "basic.com/valib/logger.git"
   "github.com/gin-gonic/gin"
   "webserver/extend/code"
   "webserver/extend/util"
@@ -17,6 +18,7 @@
   TargetIds []string `json:"targetIds" binging:"required"`
}
// @Security ApiKeyAuth
// @Summary 显示摄像机场景规则
// @Description 显示摄像机场景规则
// @Accept json
@@ -34,6 +36,7 @@
   }
   var api dbapi.CameraRuleApi
   b,d := api.FindByCameraId(cameraId)
   logger.Debug("b:", b, d)
   if b {
      util.ResponseFormat(c,code.Success,d)
   } else {
@@ -41,6 +44,7 @@
   }
}
// @Security ApiKeyAuth
// @Summary 保存摄像机独立规则
// @Description 保存摄像机独立规则
// @Accept json
@@ -59,13 +63,15 @@
   }
   param := util.Struct2Map(reqBody)
   var api dbapi.CameraRuleApi
   if api.Save(param) {
   b,d := api.Save(param)
   if b {
      util.ResponseFormat(c,code.Success,"")
   } else {
      util.ResponseFormat(c,code.ComError,"")
      util.ResponseFormat(c,code.ComError,d)
   }
}
// @Security ApiKeyAuth
// @Summary 复制摄像机规则到选定的多个摄像机
// @Description 复制摄像机规则到选定的多个摄像机
// @Accept json
@@ -91,6 +97,7 @@
   }
}
// @Security ApiKeyAuth
// @Summary 保存联动任务规则参数
// @Description 保存联动任务规则参数
// @Accept json
@@ -108,13 +115,15 @@
   }
   param := util.Struct2Map(saveBody)
   var api dbapi.CameraRuleApi
   if api.SaveLinkRulesByGroup(param) {
      util.ResponseFormat(c,code.Success,saveBody)
   b,d := api.SaveLinkRulesByGroup(param)
   if b {
      util.ResponseFormat(c,code.Success, d)
   } else {
      util.ResponseFormat(c,code.ComError, "")
      util.ResponseFormat(c,code.ComError, d)
   }
}
// @Security ApiKeyAuth
// @Summary 根据多个摄像机id查询联动任务规则设置
// @Description 根据多个摄像机id查询联动任务规则设置
// @Accept json
@@ -145,6 +154,7 @@
}
// @Security ApiKeyAuth
// @Summary 修改规则组报警等级
// @Description 修改规则组报警等级
// @Produce json
@@ -169,14 +179,15 @@
   }
}
// @Security ApiKeyAuth
// @Summary 根据分组id删除摄像机算法规则
// @Description 根据分组id删除摄像机算法规则
// @Produce json
// @Tags CameraTaskArgs
// @Tags 摄像机规则
// @Param groupId path 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/rule/deleteGroup/{groupId} [get]
// @Router /data/api-v/camera/rule/deleteGroup/{groupId} [delete]
func (crc CameraRuleController) DeleteByGroup(c *gin.Context) {
   groupId := c.Param("groupId")
   if groupId == "" {
@@ -186,6 +197,7 @@
   var api dbapi.CameraRuleApi
   if api.DeleteByGroup(groupId) {
      util.ResponseFormat(c, code.Success, "删除成功")//摄像机任务参数删除完了
   } else {
      util.ResponseFormat(c, code.ComError, "删除失败")
   }
   util.ResponseFormat(c, code.ComError, "删除失败")
}