From 2987ec0089a770a3b6a3a63a243f308c57a912f0 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期三, 31 七月 2019 19:41:38 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.14:10010/r/webserver --- controllers/esSearch.go | 11 +++++++++-- controllers/taglist.go | 12 +++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/controllers/esSearch.go b/controllers/esSearch.go index ef49c27..1c20631 100644 --- a/controllers/esSearch.go +++ b/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{}) diff --git a/controllers/taglist.go b/controllers/taglist.go index d4a2a08..802b018 100644 --- a/controllers/taglist.go +++ b/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 -- Gitblit v1.8.0