From 52bd382203ebdcce84c93f01a2806e16b5416dc5 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期一, 23 九月 2019 14:06:49 +0800
Subject: [PATCH] verify dbt tableName exist when add

---
 controllers/dbtablesCon.go |    2 +-
 controllers/user.go        |    9 ++++++++-
 middlewares/auth/auth.go   |   12 +++++++-----
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go
index 9d0d09a..9436848 100644
--- a/controllers/dbtablesCon.go
+++ b/controllers/dbtablesCon.go
@@ -265,7 +265,7 @@
 	if b {
 		util.ResponseFormat(c,code.AddSuccess, data)
 	} else {
-		util.ResponseFormat(c,code.ComError,"鏂板澶辫触")
+		util.ResponseFormat(c,code.ComError, data)
 	}
 }
 
diff --git a/controllers/user.go b/controllers/user.go
index 60cac1a..cb0dadd 100644
--- a/controllers/user.go
+++ b/controllers/user.go
@@ -86,6 +86,13 @@
 	c.JSON(http.StatusOK,"閫�鍑烘垚鍔�")
 }
 
+// @Summary 鏌ユ壘鎵�鏈夌敤鎴�
+// @Description 鏌ユ壘鎵�鏈夌敤鎴�
+// @Accept json
+// @Produce json
+// @Tags 鐢ㄦ埛
+// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
+// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
 // @Router /data/api-u/users/findAllUser [get]
 func (uc UserController) FindAllUser(c *gin.Context) {
 	var api dbapi.UserApi
@@ -110,7 +117,7 @@
 // @Accept json
 // @Produce json
 // @Tags 鐢ㄦ埛
-// @Param userVo body UserEditVo true "鐢ㄦ埛缂栬緫淇℃伅"
+// @Param userVo body controllers.UserEditVo true "鐢ㄦ埛缂栬緫淇℃伅"
 // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
 // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
 // @Router /data/api-v/users/edit [post]
diff --git a/middlewares/auth/auth.go b/middlewares/auth/auth.go
index 4c7c75d..98d4836 100644
--- a/middlewares/auth/auth.go
+++ b/middlewares/auth/auth.go
@@ -4,8 +4,10 @@
 	"github.com/gin-gonic/gin"
 	"net/http"
 	"strings"
+	"webserver/extend/code"
 	"webserver/extend/config"
 	"basic.com/valib/logger.git"
+	"webserver/extend/util"
 )
 
 const (
@@ -30,11 +32,11 @@
 		urlPath := c.Request.URL.Path
 
 		if strings.Contains(urlPath,"/data/api-v") && !strings.Contains(urlPath,"login"){
-			//jwtDriver :=NewJwtAuthDriver()
-			//if !jwtDriver.Check(c) {
-			//	util.ResponseFormat(c,code.TokenNotFound,"灏氭湭鐧诲綍锛岃鐧诲綍")
-			//	c.Abort()
-			//}
+			jwtDriver :=NewJwtAuthDriver()
+			if !jwtDriver.Check(c) {
+				util.ResponseFormat(c,code.TokenNotFound,"灏氭湭鐧诲綍锛岃鐧诲綍")
+				c.Abort()
+			}
 			c.Next()
 		} else if strings.Contains(urlPath,"/httpImage") {
 			domain := config.Server.PublicDomain

--
Gitblit v1.8.0