liuxiaolong
2019-07-25 1f81a5838218b8b23a73e0a6a73a17968b4ef3f5
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{