| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | if searchBody.CompareNum !="" { |
| | | //二次搜索,不需要再比对了 |
| | | co := service.GetCompResultByNum(searchBody.CompareNum) |
| | | if co != nil { |
| | | //二次搜索和排序 |
| | | twiceM := GetCompareDataTwice(co,&searchBody) |
| | | util.ResponseFormat(c,code.Success,twiceM) |
| | | } else { |
| | | m :=make(map[string]interface{},0) |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["total"] = 0 |
| | | m["totalList"] = []CompareResult{} |
| | | util.ResponseFormat(c,code.CompareResultGone,m) |
| | | var faceB []byte |
| | | if searchBody.CaptureId != "" {//做查找此人 |
| | | searchPeople, err := esApi.Dbpersoninfosbyid([]string{searchBody.CaptureId}, config.EsInfo.EsIndex.VideoPersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport) |
| | | if err !=nil { |
| | | util.ResponseFormat(c, code.ComError, "抓拍数据不存在,请检查") |
| | | return |
| | | } |
| | | if searchPeople !=nil && len(searchPeople) == 1{ |
| | | decodeF, err := base64.StdEncoding.DecodeString(searchPeople[0].FaceFeature) |
| | | if err !=nil { |
| | | util.ResponseFormat(c, code.ComError, "本条抓怕特征不是base64,请检查") |
| | | return |
| | | } |
| | | faceB = decodeF |
| | | } |
| | | } |
| | | //if searchBody.CompareNum !="" { |
| | | // //二次搜索,不需要再比对了 |
| | | // co := service.GetCompResultByNum(searchBody.CompareNum) |
| | | // if co != nil { |
| | | // //二次搜索和排序 |
| | | // twiceM := GetCompareDataTwice(co,&searchBody) |
| | | // util.ResponseFormat(c,code.Success,twiceM) |
| | | // } else { |
| | | // m :=make(map[string]interface{},0) |
| | | // m["compareNum"] = searchBody.CompareNum |
| | | // m["total"] = 0 |
| | | // m["totalList"] = []CompareResult{} |
| | | // util.ResponseFormat(c,code.CompareResultGone,m) |
| | | // } |
| | | //} |
| | | var sysSetApi dbapi.SysSetApi |
| | | analyServerId := "" |
| | | flag, sysconf := sysSetApi.GetServerInfo() |
| | |
| | | util.ResponseFormat(c, code.ComError, "analyServerId为空,配置有误") |
| | | return |
| | | } |
| | | if searchBody.CaptureId == ""{ |
| | | if face,ok := faceExtractedMap[searchBody.PicUrl];!ok{ |
| | | util.ResponseFormat(c, code.RequestParamError, "请重新上传图片") |
| | | return |
| | | } else { |
| | | faceB = face.FaceBytes |
| | | } |
| | | } |
| | | if faceB == nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "请重新上传图片") |
| | | return |
| | | } |
| | | arg := protomsg.CompareArgs{ |
| | | FaceFeature: face.FaceBytes, |
| | | FaceFeature: faceB, |
| | | CompareThreshold: searchBody.Threshold, |
| | | } |
| | | |
| | |
| | | m["totalList"] = []CompareResult{} |
| | | } |
| | | util.ResponseFormat(c,code.Success,m) |
| | | } |
| | | } |
| | | |
| | | func GetCompareDataTwice(co *service.CompareOnce,arg *models.EsSearch) map[string]interface{} { |