liuxiaolong
2019-07-31 2987ec0089a770a3b6a3a63a243f308c57a912f0
Merge branch 'master' of http://192.168.1.14:10010/r/webserver
2个文件已修改
23 ■■■■■ 已修改文件
controllers/esSearch.go 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/taglist.go 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/esSearch.go
@@ -84,8 +84,15 @@
        queryStr = "\"must\":[{\"multi_match\":{\"query\":\"" + queryBody + "\",\"fields\":[\"baseInfo.sex\",\"baseInfo.phoneNum.raw^1.5\",\"baseInfo.personName.raw^1.5\",\"alarmRules.alarmLevel^1.5\",\"ageDescription^1.5\",\"taskName^1.5\",\"baseInfo.tableName^1.5\",\"sex^2.0\",\"race^2.0\",\"content^1.0\",\"baseInfo.idCard^1.8\",\"cameraAddr^1.0\"]," +
            "\"type\":\"cross_fields\",\"operator\":\"OR\",\"slop\":0,\"prefix_length\":0,\"max_expansions\":50,\"zero_terms_query\":\"NONE\",\"auto_generate_synonyms_phrase_query\":true,\"fuzzy_transpositions\":true,\"boost\":1}}],"
    }
    gteDate := searchBody["searchTime"].([]interface{})[0].(string)
    lteDate := searchBody["searchTime"].([]interface{})[1].(string)
    searchTime := searchBody["searchTime"].([]interface{})
    if searchBody["searchTime"] == nil || len(searchTime) < 2 {
        info := make(map[string]interface{}, 0)
        info["err"] = "请输入时间范围"
        return info
    }
    gteDate := searchTime[0].(string)
    lteDate := searchTime[1].(string)
    //判断任务ID
    taskIdStr := ""
    taskId := searchBody["tasks"].([]interface{})
controllers/taglist.go
@@ -33,11 +33,12 @@
    sources := make([]map[string]interface{}, 0)
    for _, value := range tokenRes["datalist"].([]interface{}) {
        tokenRes := make(map[string]interface{})
        key := value.(map[string]interface{})["id"].(string)
        tr := value.(map[string]interface{})
        key := tr["id"].(string)
        tokenRes["key"] = key
        tokenRes["title"] = value.(map[string]interface{})["tableName"].(string)
        tokenRes["value"] = value.(map[string]interface{})["id"].(string)
        status := int(value.(map[string]interface{})["isDelete"].(float64))
        tokenRes["title"] = tr["tableName"].(string)
        tokenRes["value"] = tr["id"].(string)
        status := int(tr["isDelete"].(float64))
        tokenRes["status"] = status
        if status == 1 {
            if GetTotalFromDb(key) == false {
@@ -53,7 +54,7 @@
func GetTotalFromDb(id string) (flag bool) {
    flag = false
    url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
        "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_search"
        "/" + config.EsInfo.EsIndex.VideoPersons.IndexName + "/_search"
    prama := "{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"baseInfo.tableId\":\"" + id + "\"}}]}},\"size\":0}"
    buf, err := esutil.EsReq("POST", url, []byte(prama))
    if err != nil {
@@ -72,6 +73,7 @@
        fmt.Println("first hits change error!")
        return
    }
    total := int(middle["total"].(float64))
    if total > 0 {
        flag = true