From f26a0cab5bca17b7eab57f6330e576271e17a17f Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 13 十一月 2019 19:12:08 +0800
Subject: [PATCH] update ynSwagger,sync to master

---
 controllers/monitoring.go |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/controllers/monitoring.go b/controllers/monitoring.go
index 8cd1125..ccb3519 100644
--- a/controllers/monitoring.go
+++ b/controllers/monitoring.go
@@ -1,9 +1,11 @@
 package controllers
 
 import (
-	"basic.com/dbapi.git"
+	"basic.com/valib/logger.git"
 	"fmt"
+	"strconv"
 	"strings"
+	"webserver/cache"
 
 	"github.com/gin-gonic/gin"
 	"webserver/extend/code"
@@ -12,6 +14,7 @@
 	"webserver/extend/util"
 )
 
+// @Security ApiKeyAuth
 // @Summary 瀹炴椂鐩戞帶
 // @Description 瀹炴椂鐩戞帶姣斿鏁版嵁
 // @Accept  json
@@ -41,12 +44,16 @@
 		taskIdStr = "{\"terms\":{\"taskId\":[\"" + esTaskId + "\"]}},"
 	}
 	//璇锋眰澶�
-	url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
+	localConf, err2 := cache.GetServerInfo()
+	if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
+		logger.Debug("localConfig is wrong!!!")
+		util.ResponseFormat(c,code.ComError,"localConf wrong")
+		return
+	}
+	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 +
@@ -59,7 +66,7 @@
 	fmt.Println(prama)
 	fmt.Println(url)
 	tokenRes := esutil.GetEsDataReq(url, prama, true)
-	/*    for _, value := range tokenRes["datalist"].([]interface{}) {
+	/*	for _, value := range tokenRes["datalist"].([]interface{}) {
 		if value.(map[string]interface{})["personId"] != nil {
 			info := getDBPersonInfo(value.(map[string]interface{})["personId"].(string))
 			for key, val := range info {

--
Gitblit v1.8.0