From 1c6fac405125468cfd2321d8ab9dc8bb0350861f Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 13 十一月 2019 19:26:16 +0800
Subject: [PATCH] fix

---
 service/EnableStatusControlService.go |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/service/EnableStatusControlService.go b/service/EnableStatusControlService.go
index 0c760b7..a0439b1 100644
--- a/service/EnableStatusControlService.go
+++ b/service/EnableStatusControlService.go
@@ -1,22 +1,26 @@
 package service
 
 import (
-	"basic.com/dbapi.git"
+	"basic.com/valib/logger.git"
 	"encoding/json"
 	"fmt"
 	"strconv"
 	"strings"
 	"time"
+	"webserver/cache"
 	"webserver/extend/config"
 	"webserver/extend/esutil"
-	"webserver/extend/logger"
 )
 
 func GetVerificationData() []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.DbTables.IndexName + "/_search"
-	var setApi dbapi.SysSetApi
-	_, sysconf := setApi.GetServerInfo()
+
 	jsonDSL := `{
 	"query": {
 		"bool": {
@@ -27,7 +31,7 @@
 				},
 				{
 					"terms": {
-						"analyServerId": ["` + sysconf.ServerId + `",""]
+						"analyServerId": ["` + localConf.ServerId + `",""]
 					}
 				}
 			]
@@ -83,7 +87,12 @@
 		status = 1
 	}
 	enable := strconv.Itoa(status)
-	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 "localConf wrong"
+	}
+	url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
 		"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_update_by_query?refresh"
 	jsonDsl := `
 			{

--
Gitblit v1.8.0