From 711e90df27648aff82eda78d16dbbc159cceb625 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 18 九月 2019 14:16:39 +0800
Subject: [PATCH] fix fileUpload tip

---
 controllers/fileController.go |   19 +++++++++++++------
 controllers/syssetcont.go     |    6 +++---
 extend/config/config.go       |    1 -
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/controllers/fileController.go b/controllers/fileController.go
index d464bd3..db6a916 100644
--- a/controllers/fileController.go
+++ b/controllers/fileController.go
@@ -620,7 +620,7 @@
 	logger.Debug("涓婁紶鍒皐eedfs鐢ㄦ椂:", time.Since(t1))
 	t1 = time.Now()
 	if e != nil {
-		fmt.Println(e.Error())
+		logger.Debug("WeedFSClient.UploadFile err:", e)
 		return "", nil, e
 	}
 
@@ -675,8 +675,15 @@
 			defer wg.Done()
 			tIStart := time.Now()
 			filename := head.Filename
+			fileExt := path.Ext(filename)
+			fileExt = strings.ToLower(fileExt)
+			if fileExt !=".jpg" && fileExt != ".jpeg" && fileExt != ".png" {
+				lock.Lock()
+				failList = append(failList, filename)
+				lock.Unlock()
+				return
+			}
 			file, err := head.Open()
-			fmt.Println(file, err, filename)
 			if err != nil {
 				lock.Lock()
 				failList = append(failList, filename)
@@ -700,11 +707,11 @@
 	addResult["failList"] = failList
 	addResult["fields"] = extNames
 
-	if len(successList)>0 {
+	//if len(successList)>0 {
 		util.ResponseFormat(c, code.DbPersonUploadSuccess, addResult)
-	} else {
-		util.ResponseFormat(c, code.DbPersonUploadFail, addResult)
-	}
+	//} else {
+	//	util.ResponseFormat(c, code.DbPersonUploadFail, addResult)
+	//}
 }
 
 type EsPersonSave struct {
diff --git a/controllers/syssetcont.go b/controllers/syssetcont.go
index 61a4116..4c98c36 100644
--- a/controllers/syssetcont.go
+++ b/controllers/syssetcont.go
@@ -34,9 +34,9 @@
 type Gb28181ConfigVo struct {
 	Id string `json:"Id"`
 	ServerIp string `json:"ServerIp" example:"鍥芥爣鏈嶅姟鍣↖P"`
-	ServerPort int `json:"ServerPort" example:"鏈嶅姟鍣ㄧ鍙�:8060"`
-	PublicId string `json:"PublicId" example:"鍥芥爣鏈嶅姟鍣↖d"`
-	GbServerPort int `json:"GbServerPort" example:"鍥芥爣鏈嶅姟绔彛:7060"`
+	ServerPort int `json:"ServerPort" example:"骞冲彴鏈嶅姟绔彛:7060"`
+	PublicId string `json:"PublicId" example:"骞冲彴鏈嶅姟Id"`
+	GbServerPort int `json:"GbServerPort" example:"鍥芥爣鏈嶅姟绔彛:8060"`
 	IsAuth bool `json:"IsAuth" example:"鏄惁寮�鍚壌鏉�:true"`
 	Password string `json:"Password" example:"瀵嗙爜"`
 	UpdateTime string `json:"UpdateTime"`
diff --git a/extend/config/config.go b/extend/config/config.go
index 4e67b70..801282d 100644
--- a/extend/config/config.go
+++ b/extend/config/config.go
@@ -90,7 +90,6 @@
 	viper.SetConfigType("yaml")
 	viper.SetConfigName(env)
 	viper.AddConfigPath("/opt/vasystem/config/")
-	viper.AddConfigPath("")
 	err = viper.ReadInConfig()
 	if err != nil {
 		log.Fatal("error on parsing configuration file")

--
Gitblit v1.8.0