| | |
| | | if err !=nil{ |
| | | return "" |
| | | } |
| | | |
| | | var resp RespVideo |
| | | err = json.Unmarshal(respBytes, &resp) |
| | | if err !=nil { |
| | | return "" |
| | | } |
| | | |
| | | filePath := resp.FilePath |
| | | videoUrl = "" |
| | | if !strings.Contains(filePath, "/cut"){ |
| | | videoUrl = "" |
| | | fmt.Printf("videoReqUrl:%s ,imgKey:%s ,picDate:%s ,cameraId:%s ,filePath:%s \n ",reqUrl,imgKey,picDate,cameraId,filePath) |
| | | } else { |
| | | strArr := strings.Split(filePath, "/cut") |
| | | ngxUrl := ngxMap[indeviceId] |
| | |
| | | videoUrl = ngxUrl + strArr[1] |
| | | } |
| | | } |
| | | if videoUrl == "" { |
| | | fmt.Printf("videoReqUrl:%s ,imgKey:%s ,picDate:%s ,cameraId:%s ",reqUrl,imgKey,picDate,cameraId) |
| | | if videoUrl == ""{ |
| | | respMap := make(map[string]interface{},0) |
| | | err := json.Unmarshal(respBytes, &respMap) |
| | | if err !=nil { |
| | | fmt.Println("resp UnmarshalToMap err: ",err) |
| | | } |
| | | fmt.Println("resp: ",respMap) |
| | | } |
| | | |
| | | return videoUrl |
| | | } |
| | | |
| | |
| | | url := fmt.Sprintf("%s%s%s", Eurl, index, "/_search") |
| | | |
| | | seccond := strconv.Itoa(sec) |
| | | |
| | | prama := "{\"query\":{\"bool\":{\"filter\":[{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | preSec := "" |
| | | if sec > 40 { |
| | | preSec = "-40s" |
| | | } |
| | | prama := "{\"query\":{\"bool\":{\"filter\":[{\"range\":{\"picDate\":{\"gte\":\"now+8h-" + seccond + "s\",\"lt\":\"now+8h"+preSec+"\"}}}]}},\"size\":\"1000\",\"sort\":[{\"picDate\":{\"order\":\"desc\"}}]," + |
| | | "\"_source\":[\"baseInfo\",\"Gender\",\"BaseName\",\"Age\",\"personId\",\"personPicUrl\",\"indeviceName\",\"imgKey\",\"sdkType\",\"ageDescription\",\"indeviceid\",\"content\",\"Id\",\"picAddress\",\"picMaxUrl\",\"picDate\",\"Race\",\"videoNum\",\"picSmUrl\",\"taskName\",\"personIsHub\",\"idcard\",\"videoIp\",\"videoReqNum\"]" + |
| | | "}" |
| | | err, tokenRes := GetEsDataReq(url, prama, picurl, true) |