| | |
| | | preSec = strconv.Itoa(sec) |
| | | } |
| | | var filterArr []string |
| | | var mustNotArr []string |
| | | //是否查报警数据 |
| | | if ishub == "hub" { |
| | | filterArr = append(filterArr,"{\"term\":{\"alarmRules.alarmLevel.raw\":\"二级\"}}") |
| | | mustNotArr = append(mustNotArr,"{\"term\":{\"alarmRules.alarmLevel.raw\":\"五级\"}}") |
| | | } |
| | | |
| | | filterArr = append(filterArr, "{\"range\":{\"picDate\":{\"gte\":\"now+8h-"+preSec+"s\",\"lt\":\"now+8h\"}}}") |
| | | |
| | | filterStr := "" |
| | | mustNotStr := "" |
| | | if len(filterArr) >0 { |
| | | filterStr = strings.Join(filterArr, ",") |
| | | } |
| | | param := "{\"query\":{\"bool\":{\"filter\":["+filterStr+"]}},\"size\":\""+sizeStr+"\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | if len(mustNotArr) > 0 { |
| | | mustNotStr = strings.Join(mustNotArr, ",") |
| | | } |
| | | param := "{\"query\":{\"bool\":{\"filter\":["+filterStr+"],\"must_not\":["+mustNotStr+"]}},\"size\":\""+sizeStr+"\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":{\"includes\":[\"cameraAddr\",\"baseInfo\",\"targetInfo\",\"content\",\"id\",\"picMaxUrl\",\"picDate\",\"showLabels\",\"taskName\",\"sdkName\",\"videoUrl\"],\"excludes\":[\"*.feature\",\"*.attachTarget\",\"*.targetLocation\",\"alarmRules\"]}" + |
| | | "}" |
| | | err, tokenRes := GetEsDataReq(url, param, true) |