From d37076e765284f1cf8d4db7b9b34913ef07d9d34 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 19 九月 2019 20:37:37 +0800 Subject: [PATCH] get ServerId from cache --- service/EnableStatusControlService.go | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/service/EnableStatusControlService.go b/service/EnableStatusControlService.go index 045f9b9..a0439b1 100644 --- a/service/EnableStatusControlService.go +++ b/service/EnableStatusControlService.go @@ -1,7 +1,6 @@ package service import ( - "basic.com/dbapi.git" "basic.com/valib/logger.git" "encoding/json" "fmt" @@ -15,14 +14,13 @@ func GetVerificationData() []map[string]interface{} { localConf, err2 := cache.GetServerInfo() - if err2 !=nil || localConf.AlarmIp == "" { + 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.DbTables.IndexName + "/_search" - var setApi dbapi.SysSetApi - _, sysconf := setApi.GetServerInfo() + jsonDSL := `{ "query": { "bool": { @@ -33,7 +31,7 @@ }, { "terms": { - "analyServerId": ["` + sysconf.ServerId + `",""] + "analyServerId": ["` + localConf.ServerId + `",""] } } ] @@ -90,7 +88,7 @@ } enable := strconv.Itoa(status) localConf, err2 := cache.GetServerInfo() - if err2 !=nil || localConf.AlarmIp == "" { + if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { logger.Debug("localConfig is wrong!!!") return "localConf wrong" } -- Gitblit v1.8.0