From 2ad0fadf97e433bf76eea2b90edec03de84d64e6 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 08 一月 2020 10:52:17 +0800
Subject: [PATCH] personPicUrl submit add ?collection=persistent

---
 controllers/dbtableperson.go |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go
index dbc6149..6112be3 100644
--- a/controllers/dbtableperson.go
+++ b/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"
 	//鏍规嵁浜鸿劯鍧愭爣鎵e嚭浜鸿劯灏忓浘
 	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
+			//灏嗚繖寮犳姄鎷嶇殑鐓х墖涓嬭浇涓嬫潵涓婁紶鍒癱ollection=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,"鍔犲叆澶辫触")

--
Gitblit v1.8.0