取消token验证

This commit is contained in:
wuchao 2024-06-27 17:59:02 +08:00
parent 3fa9353e56
commit 4741443bcf
2 changed files with 14 additions and 15 deletions

View File

@ -13,11 +13,9 @@ import (
zh_translations "gopkg.in/go-playground/validator.v9/translations/zh" zh_translations "gopkg.in/go-playground/validator.v9/translations/zh"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"qteam/app/constants/errorcode"
"qteam/app/utils" "qteam/app/utils"
"qteam/config" "qteam/config"
"strconv"
"qteam/app/constants/errorcode"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -178,16 +176,17 @@ func Frequence(key string) bool {
} }
func GetUserId(c *gin.Context) int { func GetUserId(c *gin.Context) int {
userIdStr, _ := c.Get("userId") return 2
if userIdStr != nil { //userIdStr, _ := c.Get("userId")
var userId, _ = userIdStr.(string) //if userIdStr != nil {
atoi, err := strconv.Atoi(userId) // var userId, _ = userIdStr.(string)
if err != nil { // atoi, err := strconv.Atoi(userId)
return 0 // if err != nil {
} // return 0
return atoi // }
} // return atoi
return 0 //}
//return 0
} }
// GetUserCustNo 获取用户custNo // GetUserCustNo 获取用户custNo

View File

@ -58,8 +58,8 @@ func RegisterRoute(router *gin.Engine) {
v1.POST("/product/detail", front.ProductDetail) v1.POST("/product/detail", front.ProductDetail)
//auth //auth
//auth := v1.Group("auth") auth := v1.Group("auth")
auth := v1.Group("auth", middlewares.Auth()) //auth := v1.Group("auth", middlewares.Auth())
{ {
order := auth.Group("/order") order := auth.Group("/order")
{ {