From 5d78b36e851a5862302f2e40c99a4477020c79bc Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期五, 20 九月 2019 13:46:52 +0800
Subject: [PATCH] 查找此人时先切图

---
 controllers/capture.go |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/controllers/capture.go b/controllers/capture.go
index de43401..f263e1b 100644
--- a/controllers/capture.go
+++ b/controllers/capture.go
@@ -1,10 +1,12 @@
 package controllers
 
 import (
-	"basic.com/dbapi.git"
+	"basic.com/valib/logger.git"
 	"fmt"
 	"github.com/gin-gonic/gin"
+	"strconv"
 	"strings"
+	"webserver/cache"
 	"webserver/extend/code"
 	"webserver/extend/config"
 	"webserver/extend/esutil"
@@ -38,12 +40,16 @@
 		cameraIdStr = "{\"terms\":{\"cameraId\":[\"" + esCameraId + "\"]}},"
 	}
 	//璇锋眰澶�
-	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,"es config err")
+		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 +
@@ -52,7 +58,6 @@
 		"\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
 		"\"size\":\"1000\"," +
 		"\"_source\":[\"baseInfo\",\"alarmRules\",\"sex\",\"analyServerName\",\"sdkName\",\"ageDescription\",\"content\",\"id\",\"cameraAddr\",\"picMaxUrl\",\"picDate\",\"race\",\"videoUrl\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"isAlarm\",\"analyServerIp\",\"cameraId\"]}"
-	fmt.Println(prama)
 	tokenRes := esutil.GetEsDataReq(url, prama, true)
 	util.ResponseFormat(c, code.Success, tokenRes)
 }

--
Gitblit v1.8.0