From 0fba63d0d13e94c71f690008e5b54b18e3cf2f5b Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 20 八月 2019 15:56:27 +0800
Subject: [PATCH] fix upload

---
 controllers/fileController.go |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/controllers/fileController.go b/controllers/fileController.go
index b1b1ba4..c5a1c8b 100644
--- a/controllers/fileController.go
+++ b/controllers/fileController.go
@@ -580,29 +580,22 @@
 	cutFaceImgData := util.SubImg(*pI, int(rcFace.Left), int(rcFace.Top), int(rcFace.Right), int(rcFace.Bottom))
 	logger.Debug("SubImg鐢ㄦ椂锛�", time.Since(t1))
 	t1 = time.Now()
-	fileInfo, e := esutil.PostFormData(weedfsUri, filename, "file", cutFaceImgData)
+	weedFilePath, e := WeedFSClient.UploadFile(weedfsUri, filename, cutFaceImgData)
 	logger.Debug("涓婁紶鍒皐eedfs鐢ㄦ椂:", time.Since(t1))
 	t1 = time.Now()
 	if e != nil {
 		fmt.Println(e.Error())
 		return "", nil, e
-	} else {
-		field = fileInfo[picUrlField].(string) // 鏂囦欢璺緞
 	}
-	if strings.Contains(field,"/"){
-		idx := strings.Index(field, "/")
-		field = field[idx+1:]
-	}
+
 	ext := path.Ext(filename)
 	fileNameOnly := strings.TrimSuffix(filename, ext)
 
 	dbperson := new(models.Dbtablepersons)
-	dbperson.PersonPicUrl = field //  鍥剧墖璺粡
+	dbperson.PersonPicUrl = weedFilePath //  鍥剧墖璺粡
 	dbperson.TableId = tableId           //
 	dbperson.PersonName = fileNameOnly       // 鍥剧墖鍚�
 	dbperson.Enable = 1 //榛樿鏈夋晥
-	// 婕旂ずbase64缂栫爜
-
 	dbperson.FaceFeature = faceBase64 // 鐗瑰緛鍊糱ase64 鐮�
 
 	result := addDbPerson(dbperson)

--
Gitblit v1.8.0