From 0981ad3f85d52550436f00ed3c7bd020f1f727b0 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期六, 29 六月 2019 15:55:50 +0800
Subject: [PATCH] test

---
 controllers/fileController.go |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/controllers/fileController.go b/controllers/fileController.go
index 88c0f82..7c4cb92 100644
--- a/controllers/fileController.go
+++ b/controllers/fileController.go
@@ -127,15 +127,19 @@
 	defer file.Close()
 	field := ""
 	// weedfs 涓婁紶
-	{
-		fileInfo, e := esutil.PostFormData(weedfsUri, filename, "file", file)
-		if e != nil {
-			fmt.Println(e.Error())
-			return "", nil, e
-		} else {
-			field = fileInfo[picUrlField].(string) // 鏂囦欢璺緞
-		}
+	fileBytes, err := ioutil.ReadAll(file)
+	if err !=nil {
+		return "",nil,err
 	}
+	fmt.Println("fileBytes.len:",len(fileBytes))
+	fileInfo, e := esutil.PostFormData(weedfsUri, filename, "file", file)
+	if e != nil {
+		fmt.Println(e.Error())
+		return "", nil, e
+	} else {
+		field = fileInfo[picUrlField].(string) // 鏂囦欢璺緞
+	}
+
 	if field != "" {
 		// 杩斿洖鐗瑰緛鍊�  fileInfo["point"] = v.RcFace  fileInfo["feature"] = feat
 
@@ -155,8 +159,8 @@
 			field = field[idx+1:]
 		}
 		fmt.Println("field:",field)
-		imgB, _ := ioutil.ReadAll(file)
-		fmt.Println("img.length:",len(imgB))
+		//imgB, _ := ioutil.ReadAll(file)
+		//fmt.Println("img.length:",len(imgB))
 
 		//灏嗕笂浼犵殑鍥剧墖浜や汉鑴告娴嬪拰浜鸿劯鎻愬彇锛岃幏寰楃壒寰�
 		var faceBase64=""
@@ -187,8 +191,8 @@
 	}
 }
 
-func getFaceFeaFromSdk(file multipart.File) ([]*protomsg.ResultFaceExtCom,error){
-	s := service.NewFaceSdkService(file)
+func getFaceFeaFromSdk(fileBytes []byte) ([]*protomsg.ResultFaceExtCom,error){
+	s := service.NewFaceSdkService(fileBytes)
 	i, err := s.ReadFromUploadImg()
 	if err !=nil{
 		fmt.Println("readFromUploadImg err:",err)

--
Gitblit v1.8.0