liuxiaolong
2020-01-08 2ad0fadf97e433bf76eea2b90edec03de84d64e6
controllers/dbtableperson.go
@@ -295,7 +295,7 @@
      logger.Debug("localConfig is wrong!!!")
      return
   }
   var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit"
   var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
   //根据人脸坐标扣出人脸小图
   t1 := time.Now()
   cutFaceImgData := util.SubImg(*pI, int(rcFace.Left), int(rcFace.Top), int(rcFace.Right), int(rcFace.Bottom))
@@ -485,15 +485,24 @@
         feature = fea
      }
      if personPicUrl != "" && feature != "" {
         var dbpApi dbapi.DbPersonApi
         b,d := dbpApi.JoinDbTable(reqBody.TableIds, feature, personPicUrl)
         if b {
            util.ResponseFormat(c,code.Success,d)
            return
         } else {
            util.ResponseFormat(c,code.ComError,"加入失败")
            return
         //将这张抓拍的照片下载下来上传到collection=persistent的集合中,防止被清理掉
         picB, e3 := util.DownLoad("http://" + personPicUrl)
         if e3 == nil {
            var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
            newPersonPicUrl, e4 := WeedFSClient.UploadFile(weedfsUri, "capturePerson", picB)
            if e4 == nil {
               var dbpApi dbapi.DbPersonApi
               b,d := dbpApi.JoinDbTable(reqBody.TableIds, feature, newPersonPicUrl)
               if b {
                  util.ResponseFormat(c,code.Success,d)
                  return
               } else {
                  util.ResponseFormat(c,code.ComError,"加入失败")
                  return
               }
            }
         }
      }
   }
   util.ResponseFormat(c,code.ComError,"加入失败")