From c6ae506a28e9ce6463822bfea5369856acf980e0 Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期四, 14 一月 2021 18:19:37 +0800 Subject: [PATCH] add cameraIds to AggregateTaskList --- EsApi.go | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/EsApi.go b/EsApi.go index 96348c7..f60a1b6 100644 --- a/EsApi.go +++ b/EsApi.go @@ -1276,10 +1276,19 @@ } //鑱氬悎浠诲姟鍒楄〃锛宼askId+taskName -func AggregateTaskList(serverIp string, serverPort string, indexName string, analyServerId string) (sources []map[string]interface{}, err error) { +func AggregateTaskList(serverIp string, serverPort string, indexName string, analyServerId string, cameraIds []string) (sources []map[string]interface{}, err error) { url := "http://" + serverIp + ":" + serverPort + "/" + indexName + "/_search" serverFilterStr := "" + cameIdFilterStr := "" + if cameraIds != nil && len(cameraIds) > 0 { + cameIdsStr := strings.Replace(strings.Trim(fmt.Sprint(cameraIds), "[]"), " ", "\",\"", -1) + cameIdFilterStr = `,{ + "term": { + "cameraId": "` + cameIdsStr + `" + } + }` + } if analyServerId != "" { serverFilterStr = `, "query": { @@ -1288,8 +1297,9 @@ { "term": { "analyServerId": "` + analyServerId + `" + } } - } + ` + cameIdFilterStr + ` ] } }` -- Gitblit v1.8.0