From 2dd1fa03c93b400ff1e8e4f44e27387965e4daa7 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 19 九月 2019 17:23:59 +0800 Subject: [PATCH] get ip,port config from db,update realtime --- controllers/taglist.go | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/controllers/taglist.go b/controllers/taglist.go index d897d74..beb54e6 100644 --- a/controllers/taglist.go +++ b/controllers/taglist.go @@ -2,8 +2,11 @@ import ( "basic.com/dbapi.git" + "basic.com/valib/logger.git" "encoding/json" "fmt" + "strconv" + "webserver/cache" "webserver/extend/code" "webserver/extend/config" "webserver/extend/esutil" @@ -50,7 +53,12 @@ //鍒ゆ柇搴曞簱鏄惁鏈夋暟鎹� func GetTotalFromDb(id string) (flag bool) { flag = false - url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + + localConf, err2 := cache.GetServerInfo() + if err2 !=nil || localConf.AlarmIp == "" { + logger.Debug("localConfig is wrong!!!") + return false + } + url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + "/" + config.EsInfo.EsIndex.VideoPersons.IndexName + "/_search" prama := "{\"query\":{\"bool\":{\"filter\":[{\"term\":{\"baseInfo.tableId\":\"" + id + "\"}}]}},\"size\":0}" buf, err := esutil.EsReq("POST", url, []byte(prama)) -- Gitblit v1.8.0