| | |
| | | return dbtable, nil |
| | | } |
| | | |
| | | // 根据抓拍人员id查询抓拍人员信息 |
| | | func Videopersonsinfosbyid (id []string, indexName string, serverIp string, serverPort string) ([]protomsg.Videopersons, error) { |
| | | var videopersonsInfo []protomsg.Videopersons |
| | | videopersonsPersonId := strings.Replace(strings.Trim(fmt.Sprint(id), "[]"), " ", "\",\"", -1) |
| | | var dbinfoRequest = ` |
| | | { |
| | | "query": { |
| | | "bool": { |
| | | "filter": [{ |
| | | "terms": { |
| | | "id": [ |
| | | "`+ videopersonsPersonId +`" |
| | | ] |
| | | } |
| | | }] |
| | | } |
| | | } |
| | | } |
| | | ` |
| | | buf, err := EsReq("POST", "http://"+serverIp+":"+serverPort+"/"+indexName+"/_search",[]byte(dbinfoRequest)) |
| | | if err != nil { |
| | | return videopersonsInfo, err |
| | | } |
| | | |
| | | sources, err := Sourcelist(buf) |
| | | if err != nil { |
| | | return videopersonsInfo , err |
| | | } |
| | | |
| | | videoperson := Videopersonsbyid(sources) |
| | | println(videoperson) |
| | | return videoperson,nil |
| | | } |
| | | |
| | | // 根据底库人员id查询底库人员信息 |
| | | func Dbpersoninfosbyid (id []string, indexName string, serverIp string, serverPort string) ([]protomsg.Dbperson, error) { |
| | | var dbinfo []protomsg.Dbperson |
| | |
| | | if err != nil { |
| | | return "",err |
| | | } |
| | | |
| | | for _, source := range sources { |
| | | if name, ok := source["tableName"].(string); ok { |
| | | tablename = name |