sunty
2019-11-14 c4c73a384c1a02c26c81b0a76bb1d10062e64cb4
Merge branch 'master' of http://192.168.5.5:10010/r/webserver
24个文件已修改
154 ■■■■■ 已修改文件
controllers/area.go 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/camera.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cameraPTZ.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cameraPolygon.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cameraTask.go 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cameraTaskArgs.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cameraTimerule.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/cluster.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dbtableperson.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dictionary.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/esSearch.go 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/eventPush.go 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/fileController.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/pollConfig.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/sdk.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/sysMenu.go 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/syssetcont.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/task.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/user.go 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
extend/code/code.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.mod 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
go.sum 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
middlewares/auth/auth.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/area.go
@@ -59,9 +59,10 @@
    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"
@@ -99,6 +100,7 @@
// @Security ApiKeyAuth
// @Summary 添加menu的区域
// @Description 添加目录上区域
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags menu
// @Param name formData string true "区域名字"
@@ -127,7 +129,7 @@
// @Security ApiKeyAuth
// @Summary 修改名字
// @Description 修改区域名字
// @Accept  json
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags menu
// @Param id formData string true "区域id"
@@ -168,6 +170,7 @@
// @Security ApiKeyAuth
// @Summary 删除一个区域
// @Description 点击删除按钮时删除一个区域
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags menu
// @Param id formData string true "当前id"
controllers/camera.go
@@ -85,6 +85,7 @@
    err := c.BindJSON(&cam)
    if err != nil {
        logger.Debug("err:",err)
        util.ResponseFormat(c, code.RequestParamError, "参数错误")
        return
    }
@@ -293,6 +294,7 @@
// @Security ApiKeyAuth
// @Summary 切换摄像机运行实时或轮询的开关
// @Description 切换摄像机运行实时或轮询的开关
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags camera
// @Param cameraId formData string true "摄像机id"
controllers/cameraPTZ.go
@@ -23,6 +23,7 @@
// @Summary 云台
// @Description 摄像机云台控制
// @Security ApiKeyAuth
// @Accept json
// @Produce json
// @Tags camera
// @Param ptzBody body controllers.PTZInstruct true "控制类型:up,down,left,right,zoomin,zoomout,stop"
controllers/cameraPolygon.go
@@ -58,7 +58,6 @@
// @Security ApiKeyAuth
// @Summary 删除摄像机区域
// @Description 删除摄像机区域
// @Accept json
// @Produce json
// @Tags 摄像机多边形
// @Param  id query string  true "id"
@@ -84,7 +83,6 @@
// @Security ApiKeyAuth
// @Summary 查找摄像机区域
// @Description 查找摄像机区域
// @Accept json
// @Produce json
// @Tags 摄像机多边形
// @Param  cameraId query string  true "cameraId"
controllers/cameraTask.go
@@ -99,6 +99,7 @@
// @Security ApiKeyAuth
// @Summary 摄像机添加一个任务
// @Description 摄像机添加一个任务
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags CameraTask
// @Param cameraId formData string true "摄像机id"
@@ -245,6 +246,7 @@
// @Security ApiKeyAuth
// @Summary 保存规则组报警等级
// @Description 保存规则组报警等级
// @Accept json
// @Produce json
// @Tags CameraTask
// @Param GroupLevel body controllers.GroupAlarmLevelVo true "alarmLevel"
@@ -276,6 +278,7 @@
// @Security ApiKeyAuth
// @Summary 更新任务状态
// @Description 更新任务状态
// @Accept json
// @Produce json
// @Tags CameraTask
// @Param CameraTaskStatus body controllers.CameraTaskStatusVo true "参数结构体"
controllers/cameraTaskArgs.go
@@ -71,6 +71,7 @@
// @Security ApiKeyAuth
// @Summary 根据分组id切换布防或撤防
// @Description 根据分组id切换布防或撤防
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags CameraTaskArgs
// @Param groupId formData string true "任务算法参数分组id"
controllers/cameraTimerule.go
@@ -66,7 +66,6 @@
// @Security ApiKeyAuth
// @Summary 删除时间规则
// @Description 删除时间规则
// @Accept json
// @Produce json
// @Tags CameraTimerule
// @Param  id query string  true "id"
controllers/cluster.go
@@ -219,6 +219,7 @@
// @Security ApiKeyAuth
// @Summary 保存集群名称
// @Description 保存集群名称
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags cluster
// @Param clusterName formData string true "集群名称"
controllers/dbtableperson.go
@@ -246,7 +246,7 @@
// @Security ApiKeyAuth
// @Summary 更新底库人脸照片
// @Description 更新底库人脸照片
// @Accept  json
// @Accept multipart/form-data
// @Produce json
// @Tags dbperson 底库人员
// @Param id formData string true "人员id"
controllers/dictionary.go
@@ -32,6 +32,7 @@
// @Security ApiKeyAuth
// @Summary 根据父ID查找字典
// @Description  根据父ID查找字典
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 字典
// @Param parentId query string false "parentId"
controllers/esSearch.go
@@ -177,7 +177,7 @@
        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)
    //数据解析
@@ -190,50 +190,35 @@
    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\"]" +
controllers/eventPush.go
@@ -50,6 +50,8 @@
// @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:""}"
@@ -74,6 +76,7 @@
// @Security ApiKeyAuth
// @Summary 根据事件推送主题的一级和二级选项获取最后下拉菜单列表
// @Description  根据事件推送主题的一级和二级选项获取最后下拉菜单列表
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 事件推送
// @Param topic query string true "一级主题选项,例如:camera(摄像机)"
@@ -100,6 +103,7 @@
// @Security ApiKeyAuth
// @Summary 查全部
// @Description  查全部
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 事件推送
// @Param name query string false "事件名称"
@@ -120,6 +124,7 @@
// @Security ApiKeyAuth
// @Summary 事件推送编辑
// @Description  事件推送编辑
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 事件推送
// @Param id query string true "id"
@@ -149,6 +154,7 @@
// @Security ApiKeyAuth
// @Summary 改变enable状态
// @Description  改变enable状态
// @Accept json
// @Produce json
// @Tags 事件推送
// @Param statusBody body controllers.ChangeStatusVo true "参数结构"
controllers/fileController.go
@@ -53,7 +53,7 @@
// @Security ApiKeyAuth
// @Summary 依据图片添加底库人员
// @Description  依据图片添加底库返回数据人员
// @Accept  mpfd
// @Accept  multipart/form-data
// @Produce json
// @Tags dbperson 底库人员
// @Param file formData file true "底库人员图片"
@@ -114,6 +114,7 @@
// @Security ApiKeyAuth
// @Summary 人脸提取
// @Description  人脸提取
// @Accept multipart/form-data
// @Produce json
// @Tags 以图搜图
// @Param file formData file true "人员图片"
@@ -807,7 +808,7 @@
// @Security ApiKeyAuth
// @Summary 批量添加底库人员
// @Description  依据图片批量添加底库人员
// @Accept  mpfd
// @Accept  multipart/form-data
// @Produce json
// @Tags dbperson 底库人员
// @Param files formData file[] true "多个底库人员图片"
@@ -898,7 +899,7 @@
// @Security ApiKeyAuth
// @Summary 上传图片 并切图
// @Description  上传图片 并切图
// @Accept  mpfd
// @Accept  multipart/form-data
// @Produce json
// @Tags dbperson 底库人员
// @Param file formData file true "底库人员图片"
controllers/pollConfig.go
@@ -93,6 +93,7 @@
// @Security ApiKeyAuth
// @Summary 切换轮询开关
// @Description 切换轮询开关
// @Accept json
// @Produce json
// @Tags 轮询配置
// @Param argBody body controllers.PollEnableVo true "开关参数"
controllers/sdk.go
@@ -43,6 +43,7 @@
// @Security ApiKeyAuth
// @Summary 算法保存
// @Description 算法保存
// @Accept json
// @Produce json
// @Tags sdk
// @Param reqMap body controllers.SdkVo true "人脸检测"
controllers/sysMenu.go
@@ -16,7 +16,6 @@
// @Security ApiKeyAuth
// @Summary 当前用户的系统菜单
// @Description 当前用户的系统菜单
// @Accept json
// @Produce json
// @Tags 系统菜单
// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
@@ -38,7 +37,6 @@
// @Security ApiKeyAuth
// @Summary 查找当前用户可见的系统菜单
// @Description 查找当前用户可见的系统菜单
// @Accept json
// @Produce json
// @Tags 系统菜单
// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
controllers/syssetcont.go
@@ -101,7 +101,6 @@
// @Security ApiKeyAuth
// @Summary 存储信息修改
// @Description 存储信息修改
// @Accept  json
// @Produce json
// @Tags sysset
// @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}"
@@ -283,7 +282,6 @@
// @Security ApiKeyAuth
// @Summary 测试同步时间
// @Description 测试同步时间服务器是否可用
// @Accept  json
// @Produce json
// @Tags sysset
// @Param server query string true "时间服务器ip"
@@ -404,6 +402,7 @@
// @Summary 设置定时重启
// @Description 设置定时重启任务的配置规则
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags sysset
// @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}"
controllers/task.go
@@ -167,6 +167,7 @@
// @Security ApiKeyAuth
// @Summary 给任务添加算法
// @Description 任务添加算法
// @Accept json
// @Produce json
// @Tags task
// @Param taskSdkAdd body controllers.TaskSdkAdd true "任务id"
@@ -219,6 +220,7 @@
// @Security ApiKeyAuth
// @Summary 更新任务名称
// @Description 更新任务名称
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags task
// @Param taskId formData string true "taskId"
@@ -250,6 +252,7 @@
// @Security ApiKeyAuth
// @Summary 更新任务状态
// @Description (算法不变,只更新任务状态)
// @Accept json
// @Produce json
// @Tags task
// @Param taskStatus body controllers.TaskStatusVo true "参数"
@@ -341,6 +344,7 @@
// @Security ApiKeyAuth
// @Summary 删除算法规则
// @Description 删除算法规则
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 算法规则
// @Param taskId formData string true "taskId"
controllers/user.go
@@ -21,7 +21,7 @@
// @Summary 用户登录
// @Description 用户登录
// @Accept json
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 用户
// @Param username formData string true "用户名"
@@ -61,6 +61,35 @@
        })
    } 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,"密码有误")
    }
}
@@ -124,7 +153,7 @@
// @Security ApiKeyAuth
// @Summary 编辑此用户,返回此用户的权限菜单
// @Description 编辑此用户,返回此用户的权限菜单
// @Accept json
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 用户
// @Param userId formData string true "用户id"
@@ -155,7 +184,7 @@
// @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)
extend/code/code.go
@@ -19,7 +19,7 @@
    // 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.mod
@@ -3,7 +3,7 @@
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
go.sum
@@ -1,5 +1,5 @@
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=
middlewares/auth/auth.go
@@ -56,7 +56,7 @@
    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,"尚未登录,请登录")
router/router.go
@@ -66,6 +66,7 @@
        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 添加 路径 前缀