微信小程序\推拉流
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"xk-websocket-v2/internal/utils"
|
||||
|
||||
@@ -60,6 +61,9 @@ func JWTAuthMiddleware() gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// 调试日志:打印解析出的用户ID,帮助排查JWT问题
|
||||
log.Printf("🔑 [JWT] 请求: %s %s | 解析出的用户ID: %s", c.Request.Method, c.Request.URL.Path, userID)
|
||||
|
||||
// 步骤6: 将解析出的用户ID注入到Context中
|
||||
// 后续处理器可以通过 c.Get("user_id") 获取当前用户ID
|
||||
c.Set("user_id", userID)
|
||||
|
||||
Reference in New Issue
Block a user