| | |
| | | return aIOcean, nil |
| | | } |
| | | |
| | | // 根据抓拍人员id查询视频地址 |
| | | func AIOceanVideoUrlbyid(id string, indexName string, serverIp string, serverPort string) (string, error) { |
| | | //var aIOceanInfo []protomsg.AIOcean |
| | | //videopersonsPersonId := strings.Replace(strings.Trim(fmt.Sprint(id), "[]"), " ", "\",\"", -1) |
| | | var dbinfoRequest = ` |
| | | { |
| | | "query": { |
| | | "bool": { |
| | | "filter": [ |
| | | { |
| | | "term": { |
| | | "id": "` + id + `" |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | }, |
| | | "_source": [ |
| | | "videoUrl" |
| | | ] |
| | | } |
| | | ` |
| | | buf, err := EsReq("POST", "http://"+serverIp+":"+serverPort+"/"+indexName+"/_search", []byte(dbinfoRequest)) |
| | | if err != nil { |
| | | return "", err |
| | | } |
| | | |
| | | sources, err := Sourcelist(buf) |
| | | if err != nil { |
| | | return "", err |
| | | } |
| | | videoUrl := sources["videoUrl"].(string) |
| | | //aIOcean := AIOceanAnalysis(sources) |
| | | return videoUrl, nil |
| | | } |
| | | |
| | | //根据抓拍库人员id查询特征值 |
| | | func GetVideoPersonFaceFeatureById(id string, indexName string, serverIp string, serverPort string) (string, error) { |
| | | var jsonDSL = ` |
| | |
| | | return statu, errors.New("http response interface can not change map[string]interface{}") |
| | | } |
| | | middle, ok := out["updated"].(float64) |
| | | batches,ok1 := out["batches"].(float64) |
| | | if !ok || !ok1{ |
| | | batches, ok1 := out["batches"].(float64) |
| | | if !ok || !ok1 { |
| | | logPrint("first updated change error!") |
| | | statu = 500 |
| | | return statu, errors.New("first updated change error!") |
| | |
| | | if batches == 0 { |
| | | logPrint("no such doc in database") |
| | | statu = 400 |
| | | return statu,errors.New("目标数据不存在") |
| | | return statu, errors.New("目标数据不存在") |
| | | } else { |
| | | if middle == 1 { |
| | | statu = 200 |
| | | return statu, nil |
| | | } |
| | | if middle == 0 { |
| | | statu = 201 |
| | | return statu, errors.New("已经修改") |
| | | } |
| | | statu = 200 |
| | | return statu, nil |
| | | } |
| | | if middle == 0 { |
| | | statu = 201 |
| | | return statu, errors.New("已经修改") |
| | | } |
| | | } |
| | | return statu, nil |
| | | } |
| | |
| | | } |
| | | |
| | | //按日期范围,服务器Id删除数据 |
| | | func DeleteAnalyServerData(serverIp string, serverPort string, indexName string, startTime string, endTime string, analyServerId string) (total int, err error,) { |
| | | func DeleteAnalyServerData(serverIp string, serverPort string, indexName string, startTime string, endTime string, analyServerId string) (total int, err error, ) { |
| | | url := "http://" + serverIp + ":" + serverPort + "/" + indexName + "/_delete_by_query" |
| | | deleteJson := `{ |
| | | "query":{ |
| | |
| | | if err != nil { |
| | | return -1, errors.New("解码失败") |
| | | } |
| | | return deleteRes,nil |
| | | return deleteRes, nil |
| | | } |
| | | |
| | | //给所有节点追加删除任务信息 |