package controllers
|
|
//import (
|
// "basic.com/dbapi.git"
|
// "basic.com/valib/logger.git"
|
// "github.com/gin-gonic/gin"
|
// "strconv"
|
// "strings"
|
// "webserver/extend/code"
|
// "webserver/extend/util"
|
//)
|
//
|
//type CameraTaskArgsController struct {
|
//
|
//}
|
//
|
//// @Security ApiKeyAuth
|
//// @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")
|
// setType := c.Query("set_type")
|
// if cameraId == "" || taskId == "" || setType == "" {
|
// util.ResponseFormat(c,code.RequestParamError,"摄像机id和任务id不能为空")
|
// return
|
// }
|
// var api dbapi.CameraTaskArgsApi
|
// flag,data := api.FindByCameraAndTask(cameraId,taskId,setType)
|
//
|
// if flag {
|
// util.ResponseFormat(c, code.Success, data)
|
// } else {
|
// util.ResponseFormat(c, code.ComError, data)
|
// }
|
//}
|
//
|
//// @Security ApiKeyAuth
|
//// @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 [post]
|
//func (controller CameraTaskArgsController) GetLinkRulesByCameraIds(c *gin.Context) {
|
// var cameraIdsVo MultiCamera
|
// if err := c.BindJSON(&cameraIdsVo);err !=nil {
|
// util.ResponseFormat(c,code.RequestParamError,"参数有误")
|
// return
|
// }
|
// var api dbapi.CameraTaskArgsApi
|
// paramBody := util.Struct2Map(cameraIdsVo)
|
// flag,data := api.GetLinkRulesByCameraIds(paramBody)
|
// if flag {
|
// util.ResponseFormat(c,code.Success,data)
|
// } else {
|
// util.ResponseFormat(c,code.ComError,data)
|
// }
|
//}
|
//
|
//// @Security ApiKeyAuth
|
//// @Summary 根据分组id切换布防或撤防
|
//// @Description 根据分组id切换布防或撤防
|
//// @Accept x-www-form-urlencoded
|
//// @Produce json
|
//// @Tags CameraTaskArgs
|
//// @Param groupId formData string true "任务算法参数分组id"
|
//// @Param defenceState formData bool true "布防状态,false:撤防,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/updateDefenceStateByGroup [post]
|
//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)
|
// }
|
//}
|
//
|
//// @Security ApiKeyAuth
|
//// @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)DeleteByGroup(c *gin.Context) {
|
// groupId := c.Query("groupId")
|
// if groupId == "" {
|
// util.ResponseFormat(c, code.RequestParamError, "id必填")
|
// return
|
// }
|
// var api dbapi.CameraTaskArgsApi
|
// flag,data := api.DeleteByGroup(groupId)
|
// if flag {
|
// util.ResponseFormat(c,code.Success,data)
|
// } else {
|
// util.ResponseFormat(c,code.ComError,"删除失败")
|
// }
|
//
|
//}
|
//
|
//type SaveLinkRulesGroupVo struct {
|
// LinkTaskId string `json:"link_task_id"`//联动任务id
|
// GroupId string `json:"group_id"`//分组id
|
// GroupText string `json:"group_text"`//组规则文字
|
// Rules []LinkRuleArgVo `json:"rules"`//组内的规则
|
//}
|
//
|
//type LinkRuleArgVo struct {
|
// TaskId string `json:"task_id"`
|
// CameraTaskArgs
|
//}
|
//
|
//type CameraTaskArgs struct {
|
// Id string `json:"id"`
|
// CameraTaskId string `json:"camera_task_id"`//camera_tasks表的主键,摄像机和任务关联id或者联动任务id
|
// CameraId string `json:"camera_id"`//摄像机id
|
// PolygonId string `json:"polygon_id"`//多边形id
|
// SdkId string `json:"sdk_id"`//算法id
|
// SdkArgAlias string `json:"sdk_arg_alias"`//算法参数别名
|
// Operator string `json:"operator"`//计算方式=,>,>=等等
|
// OperatorType string `json:"operator_type"`//计算的值类型
|
// SdkArgValue string `json:"sdk_arg_value"` //算法参数值设置
|
// Sort int `json:"sort"`//排序
|
// RuleWithPre string `json:"rule_with_pre"`//与上一条记录的逻辑运算规则(&&,||)
|
// GroupId string `json:"group_id"`//分组id
|
//}
|
//
|
//// @Security ApiKeyAuth
|
//// @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 {
|
// util.ResponseFormat(c,code.RequestParamError,"参数有误")
|
// return
|
// }
|
// var api dbapi.CameraTaskArgsApi
|
// paramBody := util.Struct2Map(saveBody)
|
// flag,data := api.SaveLinkRulesByGroup(paramBody)
|
// if flag {
|
// util.ResponseFormat(c,code.Success,data)
|
// } else {
|
// util.ResponseFormat(c,code.ComError,data)
|
// }
|
//}
|
//
|
//type RuleApply2AllVo struct {
|
// CameraId string `json:"camera_id" binding:"required"`//规则拥有者id
|
//}
|
//
|
//// @Summary 将本条规则应用到所有本地视频
|
//// @Description 将本条规则应用到所有本地视频
|
//// @Produce json
|
//// @Tags CameraTaskArgs
|
//// @Param args body controllers.RuleApply2AllVo 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/ruleApply2All [post]
|
//func (controller CameraTaskArgsController) RuleApply2All(c *gin.Context) {
|
// var saveBody RuleApply2AllVo
|
// err := c.BindJSON(&saveBody)
|
// if err !=nil {
|
// util.ResponseFormat(c, code.RequestParamError, "参数有误")
|
// return
|
// }
|
// if !strings.HasPrefix(saveBody.CameraId, File_Video_Id_Pre) && !strings.HasPrefix(saveBody.CameraId, File_Img_Id_Pre) && !!strings.HasPrefix(saveBody.CameraId, File_Audio_Id_Pre) {
|
// util.ResponseFormat(c, code.RequestParamError, "参数有误")
|
// return
|
// }
|
// var api dbapi.CameraTaskApi
|
// paramBody := util.Struct2Map(saveBody)
|
// flag, data := api.RuleApply2All(paramBody)
|
// if flag {
|
// util.ResponseFormat(c,code.Success,data)
|
// } else {
|
// util.ResponseFormat(c, code.ComError, data)
|
// }
|
//}
|