liuxiaolong
2019-07-25 d28856771a456f1862fb64e9fe16ac5a05dd4c94
controllers/fileController.go
@@ -181,9 +181,9 @@
var captureTable = "capturetable" // 抓拍库
type SearchCondition struct {
   Url string `json:"url"`
   TableIds []string `json:"tableIds"`
   CompThreshold string `json:"compThreshold"`
   PicUrl string `json:"picUrl"`
   Databases []string `json:"databases"`
   Threshold string `json:"threshold"`
}
// @Summary 以图搜图
// @Description  以图搜图
@@ -197,16 +197,16 @@
func (controller FileController) SearchByPhoto(c *gin.Context) {
   var condition SearchCondition
   err := c.BindJSON(&condition)
   if err !=nil || condition.Url == "" {
   if err !=nil || condition.PicUrl == "" {
      util.ResponseFormat(c, code.RequestParamError, "参数有误")
      return
   }
   compThreshold, err := strconv.ParseFloat(condition.CompThreshold,32)
   if condition.Url == "" || err != nil {
   compThreshold, err := strconv.ParseFloat(condition.Threshold,32)
   if condition.PicUrl == "" || err != nil {
      util.ResponseFormat(c, code.RequestParamError, "参数有误")
      return
   }
   if face,ok := faceExtractedMap[condition.Url];!ok{
   if face,ok := faceExtractedMap[condition.PicUrl];!ok{
      util.ResponseFormat(c, code.RequestParamError, "参数有误")
      return
   } else {
@@ -215,8 +215,8 @@
         FaceFeature:face.FaceBytes,
         CompareThreshold:float32(compThreshold),
      }
      if condition.TableIds !=nil {
         arg.TableIds = append(arg.TableIds, condition.TableIds...)
      if condition.Databases !=nil {
         arg.TableIds = append(arg.TableIds, condition.Databases...)
      }
      b, err := proto.Marshal(&arg)
      if err !=nil{
@@ -243,8 +243,8 @@
            continue
         }
         var dbPersonM map[string]*protomsg.Esinfo
         var captureM map[string]*protomsg.Esinfo
         dbPersonM := make(map[string]*protomsg.Esinfo,0)
         captureM := make(map[string]*protomsg.Esinfo,0)
         var personIds []string
         var captureIds []string
         for _,v :=range rList{