From 00fd1d5c7f05690264bf3cf6d44ebed81109a036 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 20 八月 2019 19:20:39 +0800
Subject: [PATCH] add http:// to publicDomain

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

diff --git a/controllers/fileController.go b/controllers/fileController.go
index b1b1ba4..adb0f1d 100644
--- a/controllers/fileController.go
+++ b/controllers/fileController.go
@@ -548,7 +548,6 @@
 
 func uploadFileReturnAddr(file multipart.File, filename string, tableId string) (string, map[string]interface{}, error) {
 	defer file.Close()
-	field := ""
 	// weedfs 涓婁紶
 	fileBytes, err := ioutil.ReadAll(file)
 	if err !=nil {
@@ -580,29 +579,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