Merge branch 'master' of http://192.168.5.5:10010/r/webserver
| | |
| | | util.ResponseFormat(c, code.Success, arr) |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Accept x-www-form-urlencoded |
| | | // @Summary 刷新Gb28181平台树 |
| | | // @Description 刷新Gb28181平台树 |
| | | // @Security ApiKeyAuth |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param id formData string false "国标平台id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 添加menu的区域 |
| | | // @Description 添加目录上区域 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param name formData string true "区域名字" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 修改名字 |
| | | // @Description 修改区域名字 |
| | | // @Accept json |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param id formData string true "区域id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除一个区域 |
| | | // @Description 点击删除按钮时删除一个区域 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags menu |
| | | // @Param id formData string true "当前id" |
| | |
| | | |
| | | err := c.BindJSON(&cam) |
| | | if err != nil { |
| | | logger.Debug("err:",err) |
| | | util.ResponseFormat(c, code.RequestParamError, "参数错误") |
| | | return |
| | | } |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 切换摄像机运行实时或轮询的开关 |
| | | // @Description 切换摄像机运行实时或轮询的开关 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param cameraId formData string true "摄像机id" |
| | |
| | | // @Summary 云台 |
| | | // @Description 摄像机云台控制 |
| | | // @Security ApiKeyAuth |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags camera |
| | | // @Param ptzBody body controllers.PTZInstruct true "控制类型:up,down,left,right,zoomin,zoomout,stop" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除摄像机区域 |
| | | // @Description 删除摄像机区域 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 摄像机多边形 |
| | | // @Param id query string true "id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找摄像机区域 |
| | | // @Description 查找摄像机区域 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 摄像机多边形 |
| | | // @Param cameraId query string true "cameraId" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 摄像机添加一个任务 |
| | | // @Description 摄像机添加一个任务 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags CameraTask |
| | | // @Param cameraId formData string true "摄像机id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存规则组报警等级 |
| | | // @Description 保存规则组报警等级 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags CameraTask |
| | | // @Param GroupLevel body controllers.GroupAlarmLevelVo true "alarmLevel" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新任务状态 |
| | | // @Description 更新任务状态 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags CameraTask |
| | | // @Param CameraTaskStatus body controllers.CameraTaskStatusVo true "参数结构体" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据分组id切换布防或撤防 |
| | | // @Description 根据分组id切换布防或撤防 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags CameraTaskArgs |
| | | // @Param groupId formData string true "任务算法参数分组id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除时间规则 |
| | | // @Description 删除时间规则 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags CameraTimerule |
| | | // @Param id query string true "id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 保存集群名称 |
| | | // @Description 保存集群名称 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags cluster |
| | | // @Param clusterName formData string true "集群名称" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新底库人脸照片 |
| | | // @Description 更新底库人脸照片 |
| | | // @Accept json |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param id formData string true "人员id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据父ID查找字典 |
| | | // @Description 根据父ID查找字典 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 字典 |
| | | // @Param parentId query string false "parentId" |
| | |
| | | analyServerFilterStr + |
| | | "{\"range\":{\"picDate\":{\"from\":\"" + gteDate + "\",\"to\":\"" + lteDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}]}}," + |
| | | "\"sort\":[{\"_score\":{\"order\":\"desc\"}},{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":[\"baseInfo\",\"alarmRules\",\"sex\",\"analyServerName\",\"sdkName\",\"ageDescription\",\"content\",\"id\",\"cameraAddr\",\"picMaxUrl\",\"picDate\",\"race\",\"videoUrl\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"isAlarm\",\"analyServerIp\",\"cameraId\",\"linkId\"]" + |
| | | "\"_source\":[\"baseInfo\",\"alarmRules\",\"sex\",\"analyServerName\",\"sdkName\",\"ageDescription\",\"content\",\"id\",\"cameraAddr\",\"picMaxUrl\",\"picDate\",\"race\",\"videoUrl\",\"picSmUrl\",\"taskName\",\"isAlarm\",\"analyServerIp\",\"cameraId\",\"linkTag\",\"linkTagInfo\"]" + |
| | | "}" |
| | | //logger.Debug("findEsData.param:",prama) |
| | | //数据解析 |
| | |
| | | for _, masterInfoValues := range data.([]interface{}) { |
| | | masterInfo := masterInfoValues.(map[string]interface{}) |
| | | sources := make(map[string]interface{}, 0) |
| | | sources["activeObject"] = masterInfo |
| | | source := make([]map[string]interface{}, 0) |
| | | source = append(source, masterInfo) |
| | | linkId := "" |
| | | if masterInfo["linkId"] != nil { |
| | | linkId = masterInfo["linkId"].(string) |
| | | } |
| | | id := masterInfo["id"].(string) |
| | | if linkId != "" { |
| | | linkInfo := GetLinkInfo(linkId, id) |
| | | for _, slaveInfoValues := range linkInfo { |
| | | slaveInfo := slaveInfoValues |
| | | source = append(source, slaveInfo) |
| | | } |
| | | |
| | | if masterInfo["linkTagInfo"] != nil { |
| | | linkTagInfo := masterInfo["linkTagInfo"].([]interface{}) |
| | | delete(masterInfo, "linkTagInfo") |
| | | if len(linkTagInfo) >0 { |
| | | slaveList := make([]interface{}, 0) |
| | | slaveList = append(slaveList, masterInfo) |
| | | slaveList = append(slaveList, linkTagInfo...) |
| | | sources["list"] = slaveList |
| | | } else { |
| | | sources["list"] = []interface{}{ |
| | | masterInfo, |
| | | } |
| | | } |
| | | } else { |
| | | if _,ok := masterInfo["linkTagInfo"];ok { |
| | | delete(masterInfo, "linkTagInfo") |
| | | } |
| | | sources["list"] = []interface{}{ |
| | | masterInfo, |
| | | } |
| | | } |
| | | sources["list"] = source |
| | | |
| | | sources["activeObject"] = masterInfo |
| | | |
| | | tmpDate["datalist"] = append(tmpDate["datalist"], sources) |
| | | } |
| | | tmpAllDate["datalist"] = tmpDate["datalist"] |
| | | return tmpAllDate |
| | | } |
| | | |
| | | func GetLinkInfo(linkId string, id string) []map[string]interface{} { |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return nil |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | | "/" + config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName + "/_search?search_type=dfs_query_then_fetch" |
| | | jsonDSL := "{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"linkId\":\"" + linkId + "\"}}],\"must_not\":[{\"term\":{\"id\":\"" + id + "\"}}]}},\"size\":100}" |
| | | |
| | | buf, err := esutil.EsReq("POST", url, []byte(jsonDSL)) |
| | | if err != nil { |
| | | logger.Debug(err) |
| | | } |
| | | |
| | | sources, err := esutil.Sourcelist(buf) |
| | | if err != nil { |
| | | logger.Debug(err) |
| | | } |
| | | return sources |
| | | |
| | | } |
| | | |
| | | //sdkTYype字典"\"_source\":[\"BaseName\",\"Gender\",\"Race\",\"content\",\"idcard\",\"picAddress\",\"picDate\",\"sdkType\",\"Age\",\"personId\",\"personIsHub\",\"personPicUrl\",\"picLocalUrl\",\"picSmUrl\",\"videoIp\",\"videoNum\",\"cameraId\",\"ageDescription\",\"likePer\"]" + |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 事件推送保存 |
| | | // @Description 事件推送保存 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 事件推送 |
| | | // @Param SaveArgs body controllers.EventPushVo true "时间推送保存参数" |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据事件推送主题的一级和二级选项获取最后下拉菜单列表 |
| | | // @Description 根据事件推送主题的一级和二级选项获取最后下拉菜单列表 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 事件推送 |
| | | // @Param topic query string true "一级主题选项,例如:camera(摄像机)" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查全部 |
| | | // @Description 查全部 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 事件推送 |
| | | // @Param name query string false "事件名称" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 事件推送编辑 |
| | | // @Description 事件推送编辑 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 事件推送 |
| | | // @Param id query string true "id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 改变enable状态 |
| | | // @Description 改变enable状态 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 事件推送 |
| | | // @Param statusBody body controllers.ChangeStatusVo true "参数结构" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 依据图片添加底库人员 |
| | | // @Description 依据图片添加底库返回数据人员 |
| | | // @Accept mpfd |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param file formData file true "底库人员图片" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 人脸提取 |
| | | // @Description 人脸提取 |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags 以图搜图 |
| | | // @Param file formData file true "人员图片" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 批量添加底库人员 |
| | | // @Description 依据图片批量添加底库人员 |
| | | // @Accept mpfd |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param files formData file[] true "多个底库人员图片" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 上传图片 并切图 |
| | | // @Description 上传图片 并切图 |
| | | // @Accept mpfd |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param file formData file true "底库人员图片" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 切换轮询开关 |
| | | // @Description 切换轮询开关 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 轮询配置 |
| | | // @Param argBody body controllers.PollEnableVo true "开关参数" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 算法保存 |
| | | // @Description 算法保存 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags sdk |
| | | // @Param reqMap body controllers.SdkVo true "人脸检测" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 当前用户的系统菜单 |
| | | // @Description 当前用户的系统菜单 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 系统菜单 |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 查找当前用户可见的系统菜单 |
| | | // @Description 查找当前用户可见的系统菜单 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags 系统菜单 |
| | | // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 存储信息修改 |
| | | // @Description 存储信息修改 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags sysset |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 测试同步时间 |
| | | // @Description 测试同步时间服务器是否可用 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags sysset |
| | | // @Param server query string true "时间服务器ip" |
| | |
| | | |
| | | // @Summary 设置定时重启 |
| | | // @Description 设置定时重启任务的配置规则 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags sysset |
| | | // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 给任务添加算法 |
| | | // @Description 任务添加算法 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags task |
| | | // @Param taskSdkAdd body controllers.TaskSdkAdd true "任务id" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新任务名称 |
| | | // @Description 更新任务名称 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags task |
| | | // @Param taskId formData string true "taskId" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 更新任务状态 |
| | | // @Description (算法不变,只更新任务状态) |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags task |
| | | // @Param taskStatus body controllers.TaskStatusVo true "参数" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 删除算法规则 |
| | | // @Description 删除算法规则 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 算法规则 |
| | | // @Param taskId formData string true "taskId" |
| | |
| | | |
| | | // @Summary 用户登录 |
| | | // @Description 用户登录 |
| | | // @Accept json |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 用户 |
| | | // @Param username formData string true "用户名" |
| | |
| | | }) |
| | | } else { |
| | | c.JSON(500,"用户名或密码错误") |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 修改当前登录用户的密码 |
| | | // @Description 修改当前登录用户的密码 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 用户 |
| | | // @Param oldPwd formData string true "旧密码" |
| | | // @Param newPwd formData 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-u/users/updatePwd [post] |
| | | func (uc UserController) UpdatePwd(c *gin.Context) { |
| | | oldPwd := c.PostForm("oldPwd") |
| | | newPwd := c.PostForm("newPwd") |
| | | if oldPwd == "" || newPwd == "" { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | return |
| | | } |
| | | authDriver := auth.GenerateAuthDriver() |
| | | userM := (*authDriver).User(c) |
| | | userId := userM["id"].(string) |
| | | var userApi dbapi.UserApi |
| | | if b,_ :=userApi.UpdatePwd(userId, oldPwd, newPwd);b { |
| | | util.ResponseFormat(c,code.UpdateSuccess,"更新成功") |
| | | } else { |
| | | util.ResponseFormat(c,code.AccountPassUnmatch,"密码有误") |
| | | } |
| | | } |
| | | |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 编辑此用户,返回此用户的权限菜单 |
| | | // @Description 编辑此用户,返回此用户的权限菜单 |
| | | // @Accept json |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 用户 |
| | | // @Param userId formData string true "用户id" |
| | |
| | | // @Param userVo body controllers.UserEditVo 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/user/saveAuth [post] |
| | | // @Router /data/api-v/users/saveAuth [post] |
| | | func (uc UserController) SaveAuth(c *gin.Context) { |
| | | var userEditVo UserEditVo |
| | | err := c.BindJSON(&userEditVo) |
| | |
| | | // RequestParamError 请求参数错误 |
| | | RequestParamError = &Code{http.StatusBadRequest, false, "请求参数有误"} |
| | | // AccountPassUnmatch 该账号原密码不匹配 |
| | | AccountPassUnmatch = &Code{http.StatusBadRequest, false, "该账号原密码不匹配"} |
| | | AccountPassUnmatch = &Code{http.StatusOK, false, "该账号原密码不匹配"} |
| | | // SignupPassUnmatch 注册两次输入密码不匹配 |
| | | SignupPassUnmatch = &Code{http.StatusBadRequest, false, "注册两次输入密码不匹配"} |
| | | // AccountNameExist 账号昵称重复,请更换为其他昵称 |
| | |
| | | go 1.12 |
| | | |
| | | require ( |
| | | basic.com/dbapi.git v0.0.0-20191031093340-2802ead93fa6 // indirect |
| | | basic.com/dbapi.git v0.0.0-20191114063413-a251b5d8b758 // 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/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/dbapi.git v0.0.0-20191114063413-a251b5d8b758 h1:pVQV59Q26COk55JJGum+KSuOvvl2v5fF8ymkcdu0xp8= |
| | | basic.com/dbapi.git v0.0.0-20191114063413-a251b5d8b758/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= |
| | |
| | | return func(c *gin.Context) { |
| | | urlPath := c.Request.URL.Path |
| | | |
| | | if strings.Contains(urlPath,"/data/api-v") && !strings.Contains(urlPath,"login"){ |
| | | if strings.Contains(urlPath,"/data/api-") && !strings.Contains(urlPath,"login"){ |
| | | jwtDriver :=NewJwtAuthDriver() |
| | | if !jwtDriver.Check(c) { |
| | | util.ResponseFormat(c,code.TokenNotFound,"尚未登录,请登录") |
| | |
| | | userApi.GET("/findAllUser", userController.FindAllUser) |
| | | userApi.POST("/findById", userController.FindById) |
| | | userApi.POST("/saveAuth", userController.SaveAuth) |
| | | userApi.POST("/updatePwd", userController.UpdatePwd) |
| | | } |
| | | |
| | | urlPrefix := "/data/api-v" // wp 添加 路径 前缀 |