微信小程序\推拉流

This commit is contained in:
2025-12-15 21:57:21 +08:00
parent 2fca6e5c43
commit 73c2073cf1
14 changed files with 2545 additions and 421 deletions

View File

@@ -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)