From 4741443bcf02556c8200edd5fcf40f6a5a8ee6eb Mon Sep 17 00:00:00 2001 From: wuchao <1272174216@qq.com> Date: Thu, 27 Jun 2024 17:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88token=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/base.go | 25 ++++++++++++------------- app/http/routes/route.go | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/http/controllers/base.go b/app/http/controllers/base.go index 3c90076..dd3db27 100644 --- a/app/http/controllers/base.go +++ b/app/http/controllers/base.go @@ -13,11 +13,9 @@ import ( zh_translations "gopkg.in/go-playground/validator.v9/translations/zh" "io/ioutil" "net/http" + "qteam/app/constants/errorcode" "qteam/app/utils" "qteam/config" - "strconv" - - "qteam/app/constants/errorcode" "github.com/gin-gonic/gin" ) @@ -178,16 +176,17 @@ func Frequence(key string) bool { } func GetUserId(c *gin.Context) int { - userIdStr, _ := c.Get("userId") - if userIdStr != nil { - var userId, _ = userIdStr.(string) - atoi, err := strconv.Atoi(userId) - if err != nil { - return 0 - } - return atoi - } - return 0 + return 2 + //userIdStr, _ := c.Get("userId") + //if userIdStr != nil { + // var userId, _ = userIdStr.(string) + // atoi, err := strconv.Atoi(userId) + // if err != nil { + // return 0 + // } + // return atoi + //} + //return 0 } // GetUserCustNo 获取用户custNo diff --git a/app/http/routes/route.go b/app/http/routes/route.go index 468d094..e92ca13 100644 --- a/app/http/routes/route.go +++ b/app/http/routes/route.go @@ -58,8 +58,8 @@ func RegisterRoute(router *gin.Engine) { v1.POST("/product/detail", front.ProductDetail) //auth - //auth := v1.Group("auth") - auth := v1.Group("auth", middlewares.Auth()) + auth := v1.Group("auth") + //auth := v1.Group("auth", middlewares.Auth()) { order := auth.Group("/order") {