Merge remote-tracking branch 'origin/master'
# Conflicts:
# controllers/es.go
| | |
| | | sysThresholds: |
| | | - |
| | | value: 60 |
| | | color: #13ce66 |
| | | color: '#13ce66' |
| | | - |
| | | value: 80 |
| | | color: #FF9C4A |
| | | color: '#FF9C4A' |
| | | - |
| | | value: 95 |
| | | color: #f53d3d |
| | | color: '#f53d3d' |
| | | - |
| | | value: 100 |
| | | color: #5d0000 |
| | | color: '#5d0000' |
| | | ptzSpeed: 50 |
| | | database: |
| | | driver: sqlite |
| | | name: sqlite3 |
| | |
| | | |
| | | // @Summary 显示树形结构 |
| | | // @Description 显示左侧所有区域和摄像机 |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param parentid query string true "区域的id" |
| | |
| | | |
| | | // @Summary 显示Gb28181树形结构 |
| | | // @Description 显示Gb28181树形结构 |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param parentid query string true "区域的id" |
| | |
| | | |
| | | // @Summary 刷新Gb28181平台树 |
| | | // @Description 刷新Gb28181平台树 |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param id formData string false "国标平台id" |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除Gb28181平台 |
| | | // @Description 删除Gb28181平台 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 添加menu的区域 |
| | | // @Description 添加目录上区域 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 修改名字 |
| | | // @Description 修改区域名字 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除一个区域 |
| | | // @Description 点击删除按钮时删除一个区域 |
| | | // @Produce json |
| | |
| | | |
| | | // @Summary 添加摄像机 |
| | | // @Description "传入区域的id(areaid)和摄像机名字(name) 必须, 其他参数可以在摄像机配置点击保存进行添加" |
| | | // @Security ApiKeyAuth |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags camera |
| | |
| | | |
| | | // @Summary 更新摄像机 |
| | | // @Description "用于更新摄像机操作" |
| | | // @Security ApiKeyAuth |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags camera |
| | |
| | | |
| | | // @Summary "删除摄像机" |
| | | // @Description "根据摄像机id删除摄像机" |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param cid path string true "摄像机id example: cid0" |
| | |
| | | |
| | | // @Summary 显示摄像机 |
| | | // @Description "显示摄像机" |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param cid path string true "摄像机id" |
| | |
| | | return json.Marshal(test) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 将摄像机挂到指定的目录树下 |
| | | // @Description 将摄像机挂到指定的目录树下 |
| | | // @Produce json |
| | |
| | | fmt.Println(areaId) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除某一个目录树下的指定摄像机 |
| | | // @Description 删除某一个目录树下的指定摄像机 |
| | | // @Produce json |
| | |
| | | fmt.Println(areaId) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据server获取所有摄像机列表及信息 |
| | | // @Description 根据server获取所有摄像机列表及信息 |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param cameraName query string false "摄像机名称" |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 获取运行类型获取摄像机列表 |
| | | // @Description 获取运行类型获取摄像机列表 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 切换摄像机运行实时或轮询的开关 |
| | | // @Description 切换摄像机运行实时或轮询的开关 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新底图 |
| | | // @Description 刷新底图 |
| | | // @Produce json |
| | |
| | | RunType int `json:"run_type"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 摄像机轮询和实时状态切换 |
| | | // @Description 摄像机轮询和实时状态切换 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 统计实时和轮询的运行路数情况 |
| | | // @Description 统计实时和轮询的运行路数情况 |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @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/statisticRunInfo [get] |
| | | func (cc CameraController) StatisticRunInfo(c *gin.Context) { |
| | | var api dbapi.CameraApi |
| | | b, d := api.StatisticRunInfo() |
| | | if b { |
| | | util.ResponseFormat(c,code.Success,d) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"") |
| | | } |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "basic.com/gb28181api.git" |
| | | |
| | | "webserver/extend/code" |
| | | "webserver/extend/config" |
| | | "webserver/extend/util" |
| | | |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type PanTiltZoomController struct { |
| | | } |
| | | |
| | | type PTZInstruct struct { |
| | | CameraId string `json:"cameraId"` //摄像机id |
| | | CameraType int `json:"cameraType"` //摄像机类型 |
| | | PTZType string `json:"ptzType"` //控制类型 left right top ... stop |
| | | } |
| | | |
| | | // @Summary 云台 |
| | | // @Description 摄像机云台控制 |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param ptzBody body controllers.PTZInstruct true "控制类型:up,down,left,right,zoomin,zoomout,stop" |
| | | // @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/ptzControl [post] |
| | | func (ptz PanTiltZoomController) Move(c *gin.Context) { |
| | | var param PTZInstruct |
| | | if err := c.BindJSON(¶m); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | |
| | | ptzSpeed := config.Server.PTZSpeed |
| | | if ptzSpeed == 0 { |
| | | ptzSpeed = 50 |
| | | } |
| | | |
| | | if param.CameraType == 1 { |
| | | var api dbapi.SysSetApi |
| | | r, gb28182Config := api.Gb28181ConfigShow() |
| | | |
| | | if r { |
| | | conf, ok := gb28182Config.(map[string]interface{}) |
| | | if ok { |
| | | gb28181api.Init(conf["ServerIp"].(string), int(conf["ServerPort"].(float64))) |
| | | } else { |
| | | util.ResponseFormat(c, code.ComError, "国标配置读取失败") |
| | | return |
| | | } |
| | | |
| | | } else { |
| | | util.ResponseFormat(c, code.ComError, "国标接口查询失败") |
| | | return |
| | | } |
| | | |
| | | var gbApi gb28181api.Gb28181Api |
| | | if r := gbApi.SetCameraPtz(param.CameraId, param.PTZType, ptzSpeed); r { |
| | | util.ResponseFormat(c, code.Success, "") |
| | | } else { |
| | | util.ResponseFormat(c, code.Success, "国标接口操作失败") |
| | | } |
| | | } else { |
| | | util.ResponseFormat(c, code.Success, "不支持的摄像机类型") |
| | | } |
| | | } |
| | |
| | | Y float64 `json:"y"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存摄像机多边形 |
| | | // @Description 保存摄像机多边形 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c,code.ComError,"保存失败") |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除摄像机区域 |
| | | // @Description 删除摄像机区域 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c,code.ComError,"删除") |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找摄像机区域 |
| | | // @Description 查找摄像机区域 |
| | | // @Accept json |
| | |
| | | Polygon CameraPolygonVo `json:"polygon"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询所有任务 |
| | | // @Description "查询所有任务" |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 摄像机添加一个任务 |
| | | // @Description 摄像机添加一个任务 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询所有任务 |
| | | // @Description "查询所有任务" |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 摄像机保存任务 |
| | | // @Description 摄像机保存任务 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除摄像机的任务 |
| | | // @Description 删除摄像机的任务 |
| | | // @Produce json |
| | |
| | | AlarmLevel int `json:"alarm_level"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存任务是否下传数据 |
| | | // @Description 保存任务是否下传数据 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存规则组报警等级 |
| | | // @Description 保存规则组报警等级 |
| | | // @Produce json |
| | |
| | | Status int `json:"status"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新任务状态 |
| | | // @Description 更新任务状态 |
| | | // @Produce json |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据摄像机id和任务id查询算法配置详情 |
| | | // @Description 根据摄像机id和任务id查询算法配置详情 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据多个摄像机id查询联动任务规则设置 |
| | | // @Description 根据多个摄像机id查询联动任务规则设置 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据分组id切换布防或撤防 |
| | | // @Description 根据分组id切换布防或撤防 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @SUmmary 根据分组id删除摄像机算法规则 |
| | | // @Description 根据分组id删除摄像机算法规则 |
| | | // @Produce json |
| | |
| | | GroupId string `json:"group_id"`//分组id |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存联动任务规则参数 |
| | | // @Description 保存联动任务规则参数 |
| | | // @Accept json |
| | |
| | | Start string `json:"start"`//开始 |
| | | End string `json:"end"`//结束 |
| | | } |
| | | // |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 时间规则保存 |
| | | // @Description 时间规则保存 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c,code.ComError,"保存失败") |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除时间规则 |
| | | // @Description 删除时间规则 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c, code.ComError, "删除失败") |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找所有时间规则 |
| | | // @Description 查找所有时间规则 |
| | | // @Accept json |
| | |
| | | TreeNodes []string `json:"treeNodes"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 实时抓拍 |
| | | // @Description 实时抓拍数据 |
| | | // @Accept json |
| | |
| | | NodeIps []string `json:"nodeIps"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 创建集群 |
| | | // @Description 创建集群 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 生成集群6位随机密码 |
| | | // @Description 生成集群6位随机密码 |
| | | // @Produce json |
| | |
| | | util.ResponseFormat(c,code.Success,pwd) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询本地集群 |
| | | // @Description 查询本地集群 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 搜索集群 |
| | | // @Description 搜索集群 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 通过searchNum异步获取集群节点信息 |
| | | // @Description 通过searchNum异步获取集群节点信息 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 通过searchNum停止搜索 |
| | | // @Description 通过searchNum停止搜索 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 加入集群 |
| | | // @Description 加入集群 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存集群名称 |
| | | // @Description 保存集群名称 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 退出集群 |
| | | // @Description 退出集群 |
| | | // @Produce json |
| | |
| | | type DbPersonController struct { |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 添加底库人员 |
| | | // @Description 添加底库人员 |
| | | // @Accept json |
| | |
| | | return result |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 修改底库人员 |
| | | // @Description 修改底库人员 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 底库人员以图搜图 |
| | | // @Description 底库人员以图搜图 |
| | | // @Accept json |
| | |
| | | return resultList |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新底库人脸照片 |
| | | // @Description 更新底库人脸照片 |
| | | // @Accept json |
| | |
| | | return message |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除底库人员 |
| | | // @Description 删除库人员 |
| | | // @Accept x-www-form-urlencoded |
| | |
| | | |
| | | type DelMultiPerson []string |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除底库人员 |
| | | // @Description 删除库人员 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询底库人员列表 |
| | | // @Description 查询库人员列表 |
| | | // @Accept json |
| | |
| | | TableIds []string `json:"tableIds"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 抓拍人员加入底库 |
| | | // @Description 抓拍人员加入底库 |
| | | // @Accept json |
| | |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/dbperson/joinDbTable [POST] |
| | | func (sc *DbPersonController) JoinDbTable(c *gin.Context) { |
| | | func (dbc *DbPersonController) JoinDbTable(c *gin.Context) { |
| | | var reqBody JoinDbTVo |
| | | c.BindJSON(&reqBody) |
| | | if reqBody.CaptureId == "" || len(reqBody.TableIds) ==0 { |
| | |
| | | } |
| | | |
| | | type DbtSearch struct { |
| | | TableId string `json:"tableId"` |
| | | OrderName string `json:"orderName"` |
| | | OrderType string `json:"orderType"` |
| | | TableId string `json:"tableId"` |
| | | OrderName string `json:"orderName"` |
| | | OrderType string `json:"orderType"` |
| | | ContentValue string `json:"contentValue"` |
| | | Page int `json:"page"` |
| | | Size int `json:"size"` |
| | | Page int `json:"page"` |
| | | Size int `json:"size"` |
| | | } |
| | | |
| | | type DbPersonMove struct { |
| | | PersonId string `json:"personId"` |
| | | TableIds []string `json:"tableIds"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 人员移动 |
| | | // @Description 人员移动 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param obj body controllers.DbPersonMove true "移动参数" |
| | | // @Success 200 {string} json "{"code":200, msg:"", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"", success:false}" |
| | | // @Router /data/api-v/dbperson/move [POST] |
| | | func (dbc *DbPersonController) Move(c *gin.Context) { |
| | | var reqBody DbPersonMove |
| | | c.BindJSON(&reqBody) |
| | | if reqBody.PersonId == "" || len(reqBody.TableIds) == 0 { |
| | | util.ResponseFormat(c,code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var dbpApi dbapi.DbPersonApi |
| | | b,d := dbpApi.Move(reqBody.PersonId, reqBody.TableIds) |
| | | if b { |
| | | util.ResponseFormat(c,code.Success,d) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"") |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 人员复制 |
| | | // @Description 人员复制 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param obj body controllers.DbPersonMove true "复制参数" |
| | | // @Success 200 {string} json "{"code":200, msg:"", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"", success:false}" |
| | | // @Router /data/api-v/dbperson/copy [POST] |
| | | func (dbc *DbPersonController) Copy(c *gin.Context) { |
| | | var reqBody DbPersonMove |
| | | c.BindJSON(&reqBody) |
| | | if reqBody.PersonId == "" || len(reqBody.TableIds) == 0 { |
| | | util.ResponseFormat(c,code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var dbpApi dbapi.DbPersonApi |
| | | b,d := dbpApi.Copy(reqBody.PersonId, reqBody.TableIds) |
| | | if b { |
| | | util.ResponseFormat(c,code.Success,d) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"") |
| | | } |
| | | } |
| | |
| | | type DbTableController struct { |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 显示底库列表 |
| | | // @Description 显示同步或本地库列表 |
| | | // @Accept x-www-form-urlencoded |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询本机所有底库列表 |
| | | // @Description 查询本机所有底库列表 |
| | | // @Accept x-www-form-urlencoded |
| | |
| | | return data |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 修改底库 |
| | | // @Description 修改同步或本地库 |
| | | // @Accept json |
| | |
| | | func (dbt DbTableController) UpdateDbTables(c *gin.Context) { |
| | | dbtable := new(models.Dbtables) |
| | | err := c.BindJSON(&dbtable) |
| | | if err !=nil || dbtable.Id == "" || dbtable.TableName == "" { |
| | | if err !=nil || dbtable.Id == "" || dbtable.TableName == "" || (dbtable.Enable !=0 && dbtable.Enable !=1) { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | return |
| | | } |
| | | currentTime := time.Now() |
| | | startTime := dbtable.StartTime |
| | | endTime := "" |
| | | if dbtable.EndTime != "" { |
| | | endTime = dbtable.EndTime |
| | | } |
| | | st, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local) |
| | | if endTime != "" { |
| | | et, _ := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local) |
| | | if et.After(currentTime) && st.Before(currentTime) { |
| | | dbtable.Enable = 1 |
| | | } else { |
| | | dbtable.Enable = 0 |
| | | } |
| | | } else if st.Before(currentTime) && endTime == "" { |
| | | dbtable.Enable = 1 |
| | | } else { |
| | | dbtable.Enable = 0 |
| | | } |
| | | |
| | | paramBody := util.Struct2Map(dbtable) |
| | | var tApi dbapi.DbTableApi |
| | | b, data := tApi.UpdateDbTables(paramBody) |
| | |
| | | Enable int `json:"enable"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 修改底库状态 |
| | | // @Description 修改同步或本地库底库状态 |
| | | // @Accept json |
| | |
| | | return flag |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 添加底库 |
| | | // @Description 添加同步或本地库 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除底库 |
| | | // @Description 删除同步或本地库 |
| | | // @Accept x-www-form-urlencoded |
| | |
| | | type DictionaryController struct { |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据类型查找字典 |
| | | // @Description 根据类型查找字典 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据父ID查找字典 |
| | | // @Description 根据父ID查找字典 |
| | | // @Produce json |
| | |
| | | type EsClusterInfo struct { |
| | | Ip string `json:"ip"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 比对数据查询 |
| | | // @Description 比对数据查询 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | if searchBody.CompareNum != "" { |
| | | if searchBody.CompareNum !="" { |
| | | //二次搜索,不需要再比对了 |
| | | co := service.GetCompResultByNum(searchBody.CompareNum) |
| | | if co != nil { |
| | | //二次搜索和排序 |
| | | twiceM := GetCompareDataTwice(co, searchBody) |
| | | util.ResponseFormat(c, code.Success, twiceM) |
| | | twiceM := GetCompareDataTwice(co,searchBody) |
| | | util.ResponseFormat(c,code.Success,twiceM) |
| | | return |
| | | } else { |
| | | m := make(map[string]interface{}, 0) |
| | | m :=make(map[string]interface{},0) |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["total"] = 0 |
| | | m["totalList"] = []CompareResult{} |
| | | util.ResponseFormat(c, code.CompareResultGone, m) |
| | | util.ResponseFormat(c,code.CompareResultGone,m) |
| | | return |
| | | } |
| | | } |
| | | m := make(map[string]interface{}, 0) |
| | | m :=make(map[string]interface{},0) |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["total"] = 0 |
| | | m["totalList"] = []CompareResult{} |
| | | util.ResponseFormat(c, code.CompareResultGone, m) |
| | | util.ResponseFormat(c,code.CompareResultGone,m) |
| | | } |
| | | |
| | | func searchEsData(searchBody models.EsSearch) map[string]interface{} { |
| | |
| | | //使用es底层机制处理分页 |
| | | //请求头 |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return nil |
| | | } |
| | |
| | | |
| | | type EsSearchController struct{} |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 检索 |
| | | // @Description 信息检索和比对检索 |
| | | // @Accept json |
| | |
| | | Enable bool `json:"enable"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 事件推送保存 |
| | | // @Description 事件推送保存 |
| | | // @Tags 事件推送 |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据事件推送主题的一级和二级选项获取最后下拉菜单列表 |
| | | // @Description 根据事件推送主题的一级和二级选项获取最后下拉菜单列表 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查全部 |
| | | // @Description 查全部 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 事件推送编辑 |
| | | // @Description 事件推送编辑 |
| | | // @Produce json |
| | |
| | | Enable bool `json:"enable"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 改变enable状态 |
| | | // @Description 改变enable状态 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据id删除 |
| | | // @Description 根据id删除 |
| | | // @Accept x-www-form-urlencoded |
| | |
| | | |
| | | //var weedfsUri = "http://192.168.1.182:9500/submit" |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 依据图片添加底库人员 |
| | | // @Description 依据图片添加底库返回数据人员 |
| | | // @Accept mpfd |
| | |
| | | } |
| | | var faceExtractedMap = make(map[string]FaceExtract,0) |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 人脸提取 |
| | | // @Description 人脸提取 |
| | | // @Produce json |
| | |
| | | BaseInfo []DbPersonVo `json:"baseInfo"` |
| | | VideoUrl string `json:"videoUrl"` |
| | | SdkName string `json:"sdkName"` |
| | | AlarmRules []AlarmRuleVo `json:"alarmRules"` |
| | | } |
| | | type DbPersonVo struct { |
| | | BwType string `json:"bwType"` |
| | |
| | | type ScoreIndex struct { |
| | | CompareScore float32 |
| | | Index int |
| | | } |
| | | |
| | | type AlarmRuleVo struct { |
| | | GroupId string `json:"groupId"` |
| | | AlarmLevel string `json:"alarmLevel"` |
| | | RuleText string `json:"ruleText"` |
| | | DefenceState bool `json:"defenceState"` |
| | | IsLink bool `json:"isLink"` |
| | | LinkInfo string `json:"linkInfo"` |
| | | } |
| | | |
| | | //填充向前端返回的数据 |
| | |
| | | logger.Debug("comp videoPersons.len:",len(videopersons)) |
| | | for _,vp :=range videopersons { |
| | | isAlarmInt, _ := strconv.Atoi(vp.IsAlarm) |
| | | bi := make([]DbPersonVo,0) |
| | | var bi []DbPersonVo |
| | | for _,p :=range vp.BaseInfo { |
| | | bi = append(bi, DbPersonVo{ |
| | | PersonId: p.PersonId, |
| | |
| | | PhoneNum: p.PhoneNum, |
| | | Sex: p.Sex, |
| | | TableId: p.TableId, |
| | | BwType: strconv.Itoa(int(p.BwType)), |
| | | BwType: p.BwType, |
| | | TableName: p.TableName, |
| | | }) |
| | | } |
| | | var alarmRules []AlarmRuleVo |
| | | if vp.AlarmRules !=nil && len(vp.AlarmRules) >0 { |
| | | for _,ar :=range vp.AlarmRules { |
| | | alarmRules = append(alarmRules, AlarmRuleVo{ |
| | | GroupId: ar.GroupId, |
| | | AlarmLevel: ar.AlarmLevel, |
| | | RuleText: ar.RuleText, |
| | | DefenceState: ar.DefenceState, |
| | | IsLink: ar.IsLink, |
| | | LinkInfo: ar.LinkInfo, |
| | | }) |
| | | } |
| | | } |
| | | vpE := CompareResult{ |
| | | Id: vp.Id, |
| | |
| | | VideoUrl: vp.VideoUrl, |
| | | BaseInfo: bi, |
| | | SdkName: "人脸", |
| | | AlarmRules: alarmRules, |
| | | } |
| | | resultList[captureM[vp.Id].Index] = vpE |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 以图搜图 |
| | | // @Description 以图搜图 |
| | | // @Accept json |
| | |
| | | logger.Debug("searchPhoto first Result.len:",len(*co.CompareData),"twice len(captureIds):",len(captureIds)) |
| | | if captureIds !=nil { |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &captureIds) |
| | | aList := getTwiceSearchResult(co, &captureIds, searchBody) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | |
| | | personIdArr = append(personIdArr, pid.Id) |
| | | } |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &personIdArr) |
| | | aList := getTwiceSearchResult(co, &personIdArr, searchBody) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | |
| | | return m |
| | | } |
| | | |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string) *service.CompareList{ |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string, searchBody *models.EsSearch) *service.CompareList{ |
| | | m := make(map[string]string) |
| | | for _,capId :=range *scopeIds { |
| | | m[capId] = capId |
| | | } |
| | | var totalData service.CompareList |
| | | for _,each :=range *co.CompareData { |
| | | if _,ok :=m[each.Id];ok{ |
| | | if _,ok :=m[each.Id];ok && each.CompareScore >= searchBody.Threshold { |
| | | totalData = append(totalData, each) |
| | | } |
| | | } |
| | |
| | | |
| | | /**上传方法**/ |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 批量添加底库人员 |
| | | // @Description 依据图片批量添加底库人员 |
| | | // @Accept mpfd |
| | |
| | | } |
| | | extNames := make([]string, 0) |
| | | addResult := make(map[string]interface{}, 0) |
| | | successList := make([]string, 0) |
| | | failList := make([]string,0) |
| | | var successList []string |
| | | var failList []string |
| | | var noFaceList []string |
| | | var multiFaceList []string |
| | | tAllStart := time.Now() |
| | | var wg sync.WaitGroup |
| | | var lock sync.Mutex |
| | |
| | | field, _, err1 := uploadFileReturnAddr(file, filename, tableId) |
| | | lock.Lock() |
| | | if err1 != nil || field == "" { |
| | | failList = append(failList, filename) |
| | | if err1 !=nil && err1.Error() == "NotFeatureFindError" { |
| | | noFaceList = append(noFaceList, filename) |
| | | } else if err1 !=nil && err1.Error() == "TooManyFaces" { |
| | | multiFaceList = append(multiFaceList, filename) |
| | | } else { |
| | | failList = append(failList, filename) |
| | | } |
| | | } else { |
| | | successList = append(successList, filename) |
| | | } |
| | |
| | | logger.Debug("切",len(fileHeaders),"张人脸用时:", time.Since(tAllStart)) |
| | | addResult["successList"] = successList |
| | | addResult["failList"] = failList |
| | | addResult["noFaceList"] = noFaceList |
| | | addResult["multiFaceList"] = multiFaceList |
| | | addResult["fields"] = extNames |
| | | |
| | | //if len(successList)>0 { |
| | | if len(successList)>0 { |
| | | util.ResponseFormat(c, code.DbPersonUploadSuccess, addResult) |
| | | //} else { |
| | | // util.ResponseFormat(c, code.DbPersonUploadFail, addResult) |
| | | //} |
| | | } else { |
| | | util.ResponseFormat(c, code.DbPersonUploadFail, addResult) |
| | | } |
| | | } |
| | | |
| | | type EsPersonSave struct { |
| | |
| | | IdCard string `json:"idCard"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 上传图片 并切图 |
| | | // @Description 上传图片 并切图 |
| | | // @Accept mpfd |
New file |
| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "basic.com/gb28181api.git" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type Gb28181CloudController struct { |
| | | |
| | | } |
| | | |
| | | func (gb *Gb28181CloudController) Left(c *gin.Context) { |
| | | cameraId := c.Query("cameraId") |
| | | |
| | | var gbApi gb28181api.Gb28181Api |
| | | gbApi.SetCameraPtz(cameraId,"",3) |
| | | |
| | | } |
| | |
| | | type InitForData struct { |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 抓拍实时图数据初始化 |
| | | // @Description 实时获取数据 |
| | | // @Accept json |
| | |
| | | Tasks []string `json:"tasks"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 实时任务监控数据初始化 |
| | | // @Description 实时监控比对数据 |
| | | // @Accept json |
| | |
| | | "webserver/extend/util" |
| | | ) |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 实时监控 |
| | | // @Description 实时监控比对数据 |
| | | // @Accept json |
| | |
| | | Enable bool `json:"enable"` //是否启用轮询 |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存轮询周期 |
| | | // @Description 保存轮询周期 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存轮询延时 |
| | | // @Description 保存轮询延时 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 获取本机轮询配置 |
| | | // @Description 获取本机轮询配置 |
| | | // @Produce json |
| | |
| | | Enable bool `json:"enable"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 切换轮询开关 |
| | | // @Description 切换轮询开关 |
| | | // @Produce json |
| | |
| | | Sort int `json:"sort"` //参数顺序 |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 算法保存 |
| | | // @Description 算法保存 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找所有算法 |
| | | // @Description 查找所有算法 |
| | | // @Produce json |
| | |
| | | util.ResponseFormat(c, code.Success, sdks) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据id获取算法信息 |
| | | // @Description 根据id获取算法信息 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据taskId获取算法信息 |
| | | // @Description 根据taskId获取算法信息 |
| | | // @Produce json |
| | |
| | | |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 当前用户的系统菜单 |
| | | // @Description 当前用户的系统菜单 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找当前用户可见的系统菜单 |
| | | // @Description 查找当前用户可见的系统菜单 |
| | | // @Accept json |
| | |
| | | |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找角色列表 |
| | | // @Description 查找角色列表 |
| | | // @Tags 系统角色 |
| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "regexp" |
| | | "webserver/extend/code" |
| | | "webserver/extend/config" |
| | | "webserver/extend/sys" |
| | |
| | | NewTime string `json:"newTime" example:"手动指定时间"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 存储信息查询 |
| | | // @Description 存储信息查询 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 存储信息修改 |
| | | // @Description 存储信息修改 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 存储信息修改 |
| | | // @Description 存储信息修改 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 视频截取时长修改 |
| | | // @Description 视频截取时长信息 |
| | | // @Accept x-www-form-urlencoded |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 获取分析设备信息 |
| | | // @Description 分析设备信息 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // saveDevInfo dev_id dev_name |
| | | // @Summary 保存视频分析设备信息 |
| | | // @Description 分析设备信息 |
| | |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/sysset/saveDevInfo [POST] |
| | | func (sset SysSetController) SaveDevInfo(c *gin.Context) { |
| | | |
| | | dev_name := c.PostForm("server_name") |
| | | var api dbapi.SysSetApi |
| | | paramBody := make(map[string]interface{}, 0) |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary GB28181设置查询 |
| | | // @Description GB28181设置信息查询 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary GB28181设置信息修改 |
| | | // @Description GB28181设置修改 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 获取时间配置 |
| | | // @Description 系统时间配置信息 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c, code.Success, resData) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 测试同步时间 |
| | | // @Description 测试同步时间服务器是否可用 |
| | | // @Accept json |
| | |
| | | return |
| | | } |
| | | |
| | | isIP, err := sys.RunNTPDate(ntpServer) |
| | | if !isIP { |
| | | util.ResponseFormat(c, code.RequestParamError, "指定的服务器地址错误") |
| | | isConn := sys.RunNTPDate(ntpServer) |
| | | if !isConn { |
| | | util.ResponseFormat(c, code.RequestParamError, "NTP服务器不可用") |
| | | return |
| | | } |
| | | |
| | | if err == nil { |
| | | util.ResponseFormat(c, code.Success, "") |
| | | } else { |
| | | util.ResponseFormat(c, code.TaskStoped, "") |
| | | } |
| | | util.ResponseFormat(c, code.Success, "") |
| | | |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 设置系统时间 |
| | | // @Description 校正系统时间 |
| | | // @Accept json |
| | |
| | | util.ResponseFormat(c, code.UpdateSuccess, "配置成功") |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询系统运行信息 |
| | | // @Description 获取当前系统的运行状态,CPU, GPU, 内存等 |
| | | // @Produce json |
| | |
| | | util.ResponseFormat(c, code.UpdateSuccess, info) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询系统状态阈值设置 |
| | | // @Description 获取当前系统的运行状态,CPU, GPU, 内存的阈值配置 |
| | | // @Produce json |
| | |
| | | util.ResponseFormat(c, code.UpdateSuccess, config.Server.SysThresholds) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 重启系统 |
| | | // @Description 重启操作系统 |
| | | // @Produce json |
| | |
| | | |
| | | util.ResponseFormat(c, code.Success, "正在重启") |
| | | } |
| | | |
| | | // @Summary 获取定时重启 |
| | | // @Description 获取定时重启任务的配置规则 |
| | | // @Produce json |
| | | // @Tags sysset |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/sysset/rebootTask [GET] |
| | | func (sset SysSetController) GetRebootTask(c *gin.Context) { |
| | | _, msg := sys.ReadRebootTaskInCrontab() |
| | | util.ResponseFormat(c, code.Success, msg) |
| | | } |
| | | |
| | | // @Summary 设置定时重启 |
| | | // @Description 设置定时重启任务的配置规则 |
| | | // @Produce json |
| | | // @Tags sysset |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" |
| | | // @Router /data/api-v/sysset/rebootTask [POST] |
| | | func (sset SysSetController) SetRebootTask(c *gin.Context) { |
| | | task := c.PostForm("task") |
| | | if len(task) < 1 { |
| | | sys.CleanRebootTask() |
| | | util.ResponseFormat(c, code.Success, "配置成功") |
| | | return |
| | | } |
| | | |
| | | regEx := `^([0-9*]+\s){4}[0-9*]+$` |
| | | if r, _ := regexp.MatchString(regEx, task); !r { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数错误") |
| | | return |
| | | } |
| | | |
| | | if r := sys.UpdateRebootTask(task); !r { |
| | | util.ResponseFormat(c, code.UpdateFail, "配置失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, "配置成功") |
| | | } |
| | |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 标签列表 |
| | | // @Description 返回底库标签 |
| | | // @Accept json |
| | |
| | | FaceExtract_VirtualSdkId = "virtual-faceextract-sdk-pull"//结果输出的算法id |
| | | ) |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找所有任务,包含任务信息和对应的算法信息 |
| | | // @Description 查找所有任务 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 检索页面获取所有任务列表(包含已删除的任务) |
| | | // @Description 检索页面获取所有任务列表(包含已删除的任务) |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 添加任务 |
| | | // @Description 查找所有任务 |
| | | // @Accept json |
| | |
| | | Sort int `json:"sort"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 给任务添加算法 |
| | | // @Description 任务添加算法 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 任务删除算法 |
| | | // @Description 根据taskid和sdkid删除 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新任务名称 |
| | | // @Description 更新任务名称 |
| | | // @Produce json |
| | |
| | | Enable bool `json:"enable"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新任务状态 |
| | | // @Description (算法不变,只更新任务状态) |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除任务 |
| | | // @Description 根据任务id删除任务 |
| | | // @Produce json |
| | |
| | | SdkArgValue string `json:"sdk_arg_value"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存算法规则 |
| | | // @Description 保存算法规则 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除算法规则 |
| | | // @Description 删除算法规则 |
| | | // @Produce json |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查询算法规则 |
| | | // @Description 查询算法规则 |
| | | // @Produce json |
| | |
| | | util.ResponseFormat(c,code.ComError,"查询失败") |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 统计每个任务的摄像机数量 |
| | | // @Description 统计每个任务的摄像机数量 |
| | | // @Produce json |
| | | // @Tags task |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | | // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" |
| | | // @Router /data/api-v/task/statisticTaskCamera [get] |
| | | func (tc TaskController) StatisticTaskCamera(c *gin.Context) { |
| | | var taskApi dbapi.TaskApi |
| | | b,d := taskApi.StatisticTaskCamera() |
| | | if b { |
| | | util.ResponseFormat(c,code.Success, d) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError, "") |
| | | } |
| | | } |
| | |
| | | "webserver/extend/util" |
| | | ) |
| | | |
| | | //任务列表 |
| | | // @Security ApiKeyAuth |
| | | // @Summary 任务列表 |
| | | // @Description 返回任务列表 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 获取当前用户信息 |
| | | // @Description 获取当前用户信息 |
| | | // @Accept json |
| | |
| | | c.JSON(http.StatusOK,"退出成功") |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找所有用户 |
| | | // @Description 查找所有用户 |
| | | // @Accept json |
| | |
| | | MenuIds []string `json:"menuIds"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 编辑此用户,返回此用户的权限菜单 |
| | | // @Description 编辑此用户,返回此用户的权限菜单 |
| | | // @Accept json |
| | |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新用户名,密码和菜单权限 |
| | | // @Description 更新用户名,密码和菜单权限 |
| | | // @Accept json |
| | |
| | | ChannelCount string `mapstructure: "channelCount"` //通道个数 |
| | | DiskCount string `mapstructure: "diskCount"` //硬盘个数 |
| | | |
| | | SudoPassword string `mapstructure: "sudoPassword"` |
| | | SudoPassword string `mapstructure: "sudoPassword"` //系统密码 |
| | | SysThresholds []threshold `mapstructure: "sysThresholds"` |
| | | PTZSpeed int `mapstructure: "ptzSpeed"` // 云台移动速度 |
| | | } |
| | | |
| | | var Server = &server{} |
| | |
| | | func NTPConfig() (bool, string, string) { |
| | | status, server, interval := false, "", "" |
| | | |
| | | cmd := exec.Command("/bin/sh", "-c", "crontab -l | grep ntpdate | tr -d '\n'") |
| | | cron, _ := cmd.Output() |
| | | cron, _ := execRootCommand("crontab -l | grep ntpdate | tr -d '\n'") |
| | | if task := string(cron); task != "" { |
| | | status = true |
| | | slice := strings.Split(task, " ") |
| | |
| | | return false |
| | | } |
| | | |
| | | // args := []string{"-s", newTime} |
| | | // exec.Command("date", args...).Run() |
| | | dateCMD := fmt.Sprintf("date -s \"%s\"", newTime) |
| | | execRootCommand(dateCMD) |
| | | stopNTPCron() |
| | |
| | | return true |
| | | } |
| | | |
| | | const NTPCRONTABFILE = "~/.webServer.crontab" |
| | | const NTPCRONTABFILE = "/tmp/.webServer.crontab" |
| | | |
| | | func EnableNTPCron(server string, interval int) bool { |
| | | stopNTPCron() |
| | |
| | | return false |
| | | } |
| | | |
| | | addTask := fmt.Sprintf("echo \"*/%d * * * * /usr/sbin/ntpdate %s\" >> %s; crontab %s", interval, server, NTPCRONTABFILE, NTPCRONTABFILE) |
| | | exec.Command("/bin/sh", "-c", addTask).Run() |
| | | update := fmt.Sprintf("echo \"*/%d * * * * /usr/sbin/ntpdate %s\" >> %s", interval, server, NTPCRONTABFILE) |
| | | execRootCommand(update) |
| | | |
| | | addNTPTask := fmt.Sprintf("crontab %s", NTPCRONTABFILE) |
| | | execRootCommand(addNTPTask) |
| | | |
| | | return true |
| | | } |
| | | |
| | | func stopNTPCron() { |
| | | cleanTask := fmt.Sprintf("crontab -l | grep -v /usr/sbin/ntpdate > %s; crontab %s", NTPCRONTABFILE, NTPCRONTABFILE) |
| | | exec.Command("/bin/sh", "-c", cleanTask).Run() |
| | | update := fmt.Sprintf("crontab -l | grep -v /usr/sbin/ntpdate > %s", NTPCRONTABFILE) |
| | | execRootCommand(update) |
| | | |
| | | cleanNTPTask := fmt.Sprintf("crontab %s", NTPCRONTABFILE) |
| | | execRootCommand(cleanNTPTask) |
| | | } |
| | | |
| | | func RunNTPDate(server string) (bool, error) { |
| | | func RunNTPDate(server string) bool { |
| | | if ip := net.ParseIP(server); ip == nil { |
| | | return false, errors.New("参数错误") |
| | | return false |
| | | } |
| | | |
| | | ntpdate := fmt.Sprintf("/usr/sbin/ntpdate %s", server) |
| | | return true, exec.Command("/bin/sh", "-c", ntpdate).Run() |
| | | _, err := execRootCommand(ntpdate) |
| | | |
| | | return err == nil |
| | | } |
| | | |
| | | func Reboot() (bool, string) { |
| | |
| | | |
| | | return err == nil, string(stdout) |
| | | } |
| | | |
| | | // * * * * * /bin/echo "$(date) Perform basic-reboot-task" >> /tmp/webserver.crontab.log;/sbin/reboot & >> /tmp/webserver.crontab.log |
| | | func ReadRebootTaskInCrontab() (bool, string) { |
| | | stdout, err := execRootCommand("crontab -l | grep basic-reboot-task | sed -z -r 's/([^0-9* ]+)(.+)//g'") |
| | | return err == nil, string(stdout) |
| | | } |
| | | |
| | | func CleanRebootTask() { |
| | | update := fmt.Sprintf("crontab -l | grep -v basic-reboot-task > %s", NTPCRONTABFILE) |
| | | execRootCommand(update) |
| | | |
| | | crontab := fmt.Sprintf("crontab %s", NTPCRONTABFILE) |
| | | execRootCommand(crontab) |
| | | } |
| | | |
| | | func UpdateRebootTask(task string) bool { |
| | | CleanRebootTask() |
| | | |
| | | tasks := fmt.Sprintf("%s /bin/echo \"$(date) Perform basic-reboot-task\" >> /tmp/webserver.crontab.log;/sbin/reboot & >> /tmp/webserver.crontab.log", task) |
| | | update := fmt.Sprintf("echo '%s' >> %s", tasks, NTPCRONTABFILE) |
| | | execRootCommand(update) |
| | | addNTPTask := fmt.Sprintf("crontab %s", NTPCRONTABFILE) |
| | | _, err := execRootCommand(addNTPTask) |
| | | |
| | | return err == nil |
| | | } |
| | |
| | | go 1.12 |
| | | |
| | | require ( |
| | | basic.com/dbapi.git v0.0.0-20191029073251-acc3826d096d // indirect |
| | | basic.com/dbapi.git v0.0.0-20191031093340-2802ead93fa6 // indirect |
| | | basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb // indirect |
| | | basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b // indirect |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 // indirect |
| | | basic.com/pubsub/esutil.git v0.0.0-20191029091908-d43f2d92ecb6 // indirect |
| | | basic.com/pubsub/protomsg.git v0.0.0-20190829113947-eb5a5f99a745 |
| | | basic.com/pubsub/esutil.git v0.0.0-20191031110806-0712822ce390 // indirect |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191031110456-1a84b09fbcd1 // indirect |
| | | basic.com/valib/capture.git v0.0.0-20190924061718-7e98d8c98b3c // indirect |
| | | basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051 |
| | | basic.com/valib/goffmpeg.git v0.0.0-20191024085028-080acae08ec8 // indirect |
| | |
| | | basic.com/dbapi.git v0.0.0-20191029073251-acc3826d096d h1:DhbWFpg4/KLeYbMpaLJUlY/z5mSyCx+kPh9JY7OMd2k= |
| | | basic.com/dbapi.git v0.0.0-20191029073251-acc3826d096d/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q= |
| | | basic.com/dbapi.git v0.0.0-20191031093340-2802ead93fa6 h1:ZSRZQ031oGUT8zT9shvoX9hvFIVbLnNCpJ48SLZKVec= |
| | | basic.com/dbapi.git v0.0.0-20191031093340-2802ead93fa6/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q= |
| | | basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb h1:fM6DojeInFSCFO+wkba1jtyPiSDqw0jYKi4Tk+e+ka4= |
| | | basic.com/fileServer/WeedFSClient.git v0.0.0-20190919054037-0182b6c3f5cb/go.mod h1:FTryK8BsVLfUplx8a3+l8hJWub6VbAWZCUH7sPRZaso= |
| | | basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b h1:Qh7x2PY3HA9B404Llq+olY5/YlGYrM58bpOHa2CGcro= |
| | | basic.com/gb28181api.git v0.0.0-20191028082253-472438a8407b/go.mod h1:iKnzuRRqUEgt17894pX3oYcOG2fLYFVcXiZbPoMK7+4= |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 h1:BBA30Rgljn6MRieC4gUncETJDyna3ObyubTo9HEQ2M0= |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48/go.mod h1:gHLJZz2ee1cGL0X0ae69fs56bAxkDgEQwDhhXZJNUcY= |
| | | basic.com/pubsub/esutil.git v0.0.0-20191029091908-d43f2d92ecb6 h1:HNdnjoaOpLJvyNzUPD2Yx9tLsS7unR19O+0ZYviW2II= |
| | | basic.com/pubsub/esutil.git v0.0.0-20191029091908-d43f2d92ecb6/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20190829113947-eb5a5f99a745 h1:NQ/172pylwH5BnVwt4vlrXVN+UDn8YJc+5V2ZPaC4P0= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20190829113947-eb5a5f99a745/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/pubsub/esutil.git v0.0.0-20191031110806-0712822ce390 h1:uM/D7VJ41pg1XXpoe73QqCCnQTE08VhXQ2JAAOnN6ao= |
| | | basic.com/pubsub/esutil.git v0.0.0-20191031110806-0712822ce390/go.mod h1:yIvppFPFGC61DOdm71ujnsxZBMFUu2yKjr5O43bMWCw= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191031110456-1a84b09fbcd1 h1:w/hlV2znPkwQxusqH8IIeg8+O3DPkCbRhsVKi6GdckU= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191031110456-1a84b09fbcd1/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/valib/capture.git v0.0.0-20190924061718-7e98d8c98b3c h1:aNujtcGxq0cNLSK08cCamAiUYiQ2/ZsUMNXbX2w8Clc= |
| | | basic.com/valib/capture.git v0.0.0-20190924061718-7e98d8c98b3c/go.mod h1:y+h7VUnoSQ3jOtf2K3twXNA8fYDfyUsifSswcyKLgNw= |
| | | basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051/go.mod h1:bkYiTUGzckyNOjAgn9rB/DOjFzwoSHJlruuWQ6hu6IY= |
| | |
| | | package auth |
| | | |
| | | import ( |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "net/http" |
| | | "strings" |
| | |
| | | c.Abort() |
| | | } |
| | | user := (*jwtDriver).User(c) |
| | | fmt.Println("AuthHandler user:",user) |
| | | if user == nil { |
| | | util.ResponseFormat(c,code.TokenNotFound,"尚未登录,请登录") |
| | | c.Abort() |
| | |
| | | sysMenuController := new(controllers.SysMenuController) |
| | | clusterController := new(controllers.ClusterController) |
| | | sysRoleController := new(controllers.RoleController) |
| | | ptController := new(controllers.PanTiltController) |
| | | ptzController := new(controllers.PanTiltZoomController) |
| | | |
| | | sysApi := r.Group("/data/api-u/sys") |
| | | { |
| | |
| | | camera.POST("/changeRunType", cameraController.ChangeRunType) |
| | | camera.GET("/getAllCamerasByServer", cameraController.GetAllCamerasByServer) |
| | | |
| | | camera.POST("/ptControl", ptController.Controlling) |
| | | camera.POST("/ptzControl", ptzController.Move) |
| | | camera.GET("/statisticRunInfo", cameraController.StatisticRunInfo) |
| | | } |
| | | |
| | | cameraTaskArgsApi := r.Group(urlPrefix + "/cameraTaskArgs") |
| | |
| | | task.GET("/getRulesByTaskSdk", taskController.GetRulesByTaskSdk) |
| | | task.POST("/deleteTaskSdkRule", taskController.DeleteTaskSdkRule) |
| | | task.POST("/saveTaskSdkRule", taskController.SaveTaskSdkRule) |
| | | |
| | | task.GET("/statisticTaskCamera", taskController.StatisticTaskCamera) |
| | | } |
| | | |
| | | // 检索 查询 节点操作 |
| | |
| | | vdbperson.POST("/updateFace", dbPersonCont.UpdateFace) |
| | | |
| | | vdbperson.POST("/joinDbTable", dbPersonCont.JoinDbTable) |
| | | vdbperson.POST("/move", dbPersonCont.Move) |
| | | vdbperson.POST("/copy", dbPersonCont.Copy) |
| | | } |
| | | |
| | | // 系统设置 操作 |
| | |
| | | vsset.GET("/sysThresholds", ssController.GetSysThresholds) |
| | | |
| | | vsset.GET("/reboot", ssController.RebootOS) |
| | | vsset.GET("/rebootTask", ssController.GetRebootTask) |
| | | vsset.POST("/rebootTask", ssController.SetRebootTask) |
| | | } |
| | | |
| | | //算法库操作 |