| | |
| | | func (controller FileController) SearchByPhoto(c *gin.Context) { |
| | | var condition SearchCondition |
| | | err := c.BindJSON(&condition) |
| | | if err !=nil || condition.PicUrl == "" { |
| | | if err !=nil || condition.PicUrl == "" || len(condition.Databases) == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | |
| | | return |
| | | } |
| | | if face,ok := faceExtractedMap[condition.PicUrl];!ok{ |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | util.ResponseFormat(c, code.RequestParamError, "请重新上传图片") |
| | | return |
| | | } else { |
| | | arg := protomsg.CompareArgs{ |
| | | TableIds:[]string{ captureTable }, |
| | | FaceFeature:face.FaceBytes, |
| | | CompareThreshold:float32(compThreshold), |
| | | TableIds: condition.Databases, |
| | | FaceFeature: face.FaceBytes, |
| | | CompareThreshold: float32(compThreshold), |
| | | } |
| | | if condition.Databases !=nil { |
| | | arg.TableIds = append(arg.TableIds, condition.Databases...) |
| | |
| | | var dbP = DbPersonVo { |
| | | PersonId: p.Id, |
| | | IdCard: p.IdCard, |
| | | CompareScore: dbPersonM[p.Id].CompareScore, |
| | | CompareScore: util.ParseScore(dbPersonM[p.Id].CompareScore), |
| | | MonitorLevel: p.MonitorLevel, |
| | | PersonName: p.PersonName, |
| | | PersonPicUrl: p.PersonPicUrl, |