From 5d78b36e851a5862302f2e40c99a4477020c79bc Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期五, 20 九月 2019 13:46:52 +0800 Subject: [PATCH] 查找此人时先切图 --- controllers/esSearch.go | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/controllers/esSearch.go b/controllers/esSearch.go index 9172bac..feeb04c 100644 --- a/controllers/esSearch.go +++ b/controllers/esSearch.go @@ -6,6 +6,7 @@ "github.com/gin-gonic/gin" "strconv" "strings" + "webserver/cache" "webserver/extend/code" "webserver/extend/config" "webserver/extend/esutil" @@ -140,11 +141,15 @@ //浣跨敤es搴曞眰鏈哄埗澶勭悊鍒嗛〉 //璇锋眰澶� - url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + + 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)) + "/" + index + "/_search?search_type=dfs_query_then_fetch" - var setApi dbapi.SysSetApi - _, sysconf := setApi.GetServerInfo() - analyServerFilterStr := "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}}," + + analyServerFilterStr := "{\"term\":{\"analyServerId\":\"" + localConf.ServerId + "\"}}," //璇锋眰浣� prama := "{\"from\":\"" + from + "\"," + @@ -196,7 +201,12 @@ } func GetLinkInfo(linkId string, id string) []map[string]interface{} { - url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + + 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.keyword\":\"" + linkId + "\"}}],\"must_not\":[{\"term\":{\"id\":\"" + id + "\"}}]}},\"size\":100}" -- Gitblit v1.8.0