sunty
2021-01-14 c6ae506a28e9ce6463822bfea5369856acf980e0
EsApi.go
@@ -1276,10 +1276,19 @@
}
//聚合任务列表,taskId+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 + `
         ]
         }
      }`