From 18df4e2032a7a1f3abc8cee6e73f6f41e064520b Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 09 六月 2020 12:01:35 +0800
Subject: [PATCH] fix
---
controllers/capture.go | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/controllers/capture.go b/controllers/capture.go
index 5d66d37..fd70180 100644
--- a/controllers/capture.go
+++ b/controllers/capture.go
@@ -44,9 +44,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,"es config err")
+ util.ResponseFormat(c, code.ComError, "es config err")
return
}
url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
@@ -56,19 +56,22 @@
linkTagInfoAnalyServerFilterStr := "{\"term\":{\"linkTagInfo.analyServerId\":\"" + localConf.ServerId + "\"}},"
prama := "{\"query\":{\"bool\":{\"should\":[" +
"{\"bool\":{\"filter\":[" +
- "{\"term\":{\"isAlarm\":\"1\"}}," +
+ "{\"term\":{\"isAlarm\":true}}," +
cameraIdStr +
analyServerFilterStr +
+ "{\"range\":{\"picDate\":{\"gte\":\"now+8h-15s\",\"lt\":\"now+8h\"}}}" +
"]}}," +
"{\"bool\":{\"filter\":[" +
- "{\"term\":{\"isAlarm\":\"1\"}}," +
+ "{\"term\":{\"isAlarm\":true}}," +
linkTagInfoCameraIdStr +
linkTagInfoAnalyServerFilterStr +
+ "{\"range\":{\"linkTagInfo.picDate\":{\"gte\":\"now+8h-15s\",\"lt\":\"now+8h\"}}}" +
"]}}" +
- "]}}," +
+ "],\"minimum_should_match\":1}}," +
"\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," +
"\"size\":\"1000\"," +
"\"_source\":{\"includes\":[],\"excludes\":[\"*.feature\"]}}"
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