From f9a9f85a43c2a5b21ce4e1be1d1fa4d42dadea3e Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 11 三月 2020 16:24:57 +0800
Subject: [PATCH] fix face upload
---
controllers/initForData.go | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/controllers/initForData.go b/controllers/initForData.go
index 522995b..abd5bbb 100644
--- a/controllers/initForData.go
+++ b/controllers/initForData.go
@@ -33,16 +33,16 @@
c.BindJSON(&searchBody)
index := config.EsInfo.EsIndex.AiOcean.IndexName
localConf, err2 := cache.GetServerInfo()
- if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
+ if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
logger.Debug("localConfig is wrong!!!")
- util.ResponseFormat(c,code.ComError,"localConf wrong")
+ util.ResponseFormat(c, code.ComError, "localConf wrong")
return
}
url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
"/" + index + "/_search"
cameraIdStr := ""
linkTagInfoCameraIdStr := ""
- if searchBody.TreeNodes !=nil {
+ if searchBody.TreeNodes != nil {
cameraId := searchBody.TreeNodes
if cameraId != nil && len(cameraId) > 0 {
esCameraId := strings.Replace(strings.Trim(fmt.Sprint(cameraId), "[]"), " ", "\",\"", -1)
@@ -56,27 +56,28 @@
prama := "{\"query\":{\"bool\":{\"should\":[" +
"{\"bool\":{\"filter\":[" +
- "{\"term\":{\"isAlarm\":\"1\"}}," +
+ "{\"term\":{\"isAlarm\":true}}," +
cameraIdStr +
analyServerFilterStr +
"]}}," +
"{\"bool\":{\"filter\":[" +
- "{\"term\":{\"isAlarm\":\"1\"}}," +
+ "{\"term\":{\"isAlarm\":true}}," +
linkTagInfoCameraIdStr +
linkTagInfoAnalyServerFilterStr +
- "]}}," +
- "\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
+ "]}}" +
+ "],\"minimum_should_match\":1}}," +
"\"size\":\"20\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
"\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}" +
"}"
- //logger.Debug("InitForCaptureData:", prama)
+ logger.Debug("InitForCaptureData:", prama)
tokenRes := esutil.GetEsDataReq(url, prama, true)
- util.ResponseFormat(c, code.Success, tokenRes)
+ tmpAllDate := esutil.ResponseData(tokenRes)
+ util.ResponseFormat(c, code.Success, tmpAllDate)
}
type InitForMonitorArg struct {
TreeNodes []string `json:"treeNodes"`
- Tasks []string `json:"tasks"`
+ Tasks []string `json:"tasks"`
}
// @Security ApiKeyAuth
@@ -113,9 +114,9 @@
}
//璇锋眰澶�
localConf, err2 := cache.GetServerInfo()
- if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
+ if err2 != nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
logger.Debug("localConfig is wrong!!!")
- util.ResponseFormat(c,code.ComError,"localConf wrong")
+ util.ResponseFormat(c, code.ComError, "localConf wrong")
return
}
url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
@@ -135,12 +136,13 @@
linkTagInfoCameraIdStr +
linkTagInfoAnalyServerFilterStr +
"]}}" +
- "]}}," +
+ "],\"minimum_should_match\":1}}," +
"\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
"\"size\":\"20\"," +
"\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}}"
//logger.Debug("url:", url)
//logger.Debug("InitForMonitoringData:", prama)
tokenRes := esutil.GetEsDataReq(url, prama, true)
- util.ResponseFormat(c, code.Success, tokenRes)
+ tmpAllDate := esutil.ResponseData(tokenRes)
+ util.ResponseFormat(c, code.Success, tmpAllDate)
}
--
Gitblit v1.8.0