liuxiaolong
2019-08-05 3898fd838546c35f70eb533d4cbc340e41b553d2
Merge branch 'master' of http://192.168.1.14:10010/r/webserver
3个文件已修改
50 ■■■■■ 已修改文件
controllers/dbtableperson.go 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dbtablesCon.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/monitoring.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/dbtableperson.go
@@ -132,6 +132,46 @@
    }
}
func UpdateDbPersonsOfDbTable(id string) (message string) {
    url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
        "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_update_by_query?refresh"
    jsonDSL := `
            {
    "script": {
        "lang": "painless",
        "inline": "ctx._source.enable = 0"
    },
    "query": {
        "term": {
            "tableId": "` + id + `"
        }
    }
}
`
    buf, err := esutil.EsReq("POST", url, []byte(jsonDSL))
    if err != nil {
        logger.Debug("http request info is err!")
        message = "修改失败"
    }
    var info interface{}
    json.Unmarshal(buf, &info)
    out, ok := info.(map[string]interface{})
    if !ok {
        logger.Debug("http response interface can not change map[string]interface{}")
        message = "修改失败"
    }
    middle, ok := out["updated"].(float64)
    if !ok {
        logger.Debug("first result change error!")
        message = "修改失败"
    }
    if middle >= 0 {
        logger.Debug("修改成功")
        message = "修改成功,更新状态条数为" + strconv.Itoa(int(middle))
    }
    return message
}
// @Summary 删除底库人员
// @Description 删除库人员
// @Accept  x-www-form-urlencoded
controllers/dbtablesCon.go
@@ -98,6 +98,11 @@
    data := esutil.GetEsDataReq(url, params, false)
    //c.JSON(200, changeEsRespData(data, "修改成功"))
    result := changeEsRespData(data, "修改成功")
    if dbtable.Enable == 0 {
        res := UpdateDbPersonsOfDbTable(dbtable.Id)
        //fmt.Println("同步修改人员状态成功----",res)
        logger.Debug("同步修改人员状态成功----", res)
    }
    if result["success"].(bool) {
        //code.Success.Message = "修改底库成功"
        //if dbtable.Enable ==1 {
controllers/monitoring.go
@@ -26,7 +26,7 @@
    searchBody := make(map[string]interface{}, 0)
    c.BindJSON(&searchBody)
    index := config.EsInfo.EsIndex.VideoPersons.IndexName
    index := config.EsInfo.EsIndex.VideoPersons.IndexName + "," + config.EsInfo.EsIndex.Personaction.IndexName
    cameraIdStr := ""
    cameraId := searchBody["treeNodes"].([]interface{})
    if cameraId != nil && len(cameraId) > 0 {
@@ -56,7 +56,8 @@
        "\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
        "\"size\":\"1000\"," +
        "\"_source\":[\"baseInfo\",\"alarmRules\",\"sex\",\"analyServerName\",\"sdkName\",\"ageDescription\",\"content\",\"id\",\"cameraAddr\",\"picMaxUrl\",\"picDate\",\"race\",\"videoUrl\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"isAlarm\",\"analyServerIp\",\"cameraId\"]}"
    //fmt.Println(prama)
    fmt.Println(prama)
    fmt.Println(url)
    tokenRes := esutil.GetEsDataReq(url, prama, true)
    /*    for _, value := range tokenRes["datalist"].([]interface{}) {
        if value.(map[string]interface{})["personId"] != nil {