From 9ef020f229d454f161a3c859dbe0ef67a430509f Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Fri, 13 Jun 2025 13:58:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=A6=E6=88=AA=E8=AF=B7=E6=B1=82=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 320a94f..aefd1e1 100644 --- a/main.go +++ b/main.go @@ -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) {