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

---
 controllers/monitoring.go |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/controllers/monitoring.go b/controllers/monitoring.go
index 70414ea..8586698 100644
--- a/controllers/monitoring.go
+++ b/controllers/monitoring.go
@@ -1,7 +1,6 @@
 package controllers
 
 import (
-	"basic.com/dbapi.git"
 	"basic.com/valib/logger.git"
 	"fmt"
 	"strconv"
@@ -45,7 +44,7 @@
 	}
 	//璇锋眰澶�
 	localConf, err2 := cache.GetServerInfo()
-	if err2 !=nil || localConf.AlarmIp == "" {
+	if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
 		logger.Debug("localConfig is wrong!!!")
 		util.ResponseFormat(c,code.ComError,"localConf wrong")
 		return
@@ -53,9 +52,7 @@
 	url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
 		"/" + index + "/_search"
 
-	var setApi dbapi.SysSetApi
-	_, sysconf := setApi.GetServerInfo()
-	analyServerFilterStr := "{\"term\":{\"analyServerId\":\"" + sysconf.ServerId + "\"}},"
+	analyServerFilterStr := "{\"term\":{\"analyServerId\":\"" + localConf.ServerId + "\"}},"
 
 	prama := "{\"query\":{\"bool\":{\"filter\":[" +
 		cameraIdStr +

--
Gitblit v1.8.0