拦截请求处理

This commit is contained in:
junleea 2025-06-13 13:58:47 +08:00
parent 4e915d02ef
commit 9ef020f229
1 changed files with 2 additions and 0 deletions

View File

@ -178,7 +178,9 @@ func JWTAuthMiddleware() gin.HandlerFunc {
// 将用户信息添加到上下文中
id := token.Claims.(jwt.MapClaims)["id"]
username := token.Claims.(jwt.MapClaims)["username"]
c.Set("id", id)
c.Set("username", username)
c.Set("user_id", int(id.(float64)))
if UserFuncIntercept(int(id.(float64)), c.Request.URL.Path) {