From 0d3258816045980d68d1b695106501026f424944 Mon Sep 17 00:00:00 2001 From: sunty <suntianyu0923@163.com> Date: 星期三, 31 七月 2019 19:28:27 +0800 Subject: [PATCH] fix indexName --- controllers/taglist.go | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) 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