fix wxh5 jwt userid type
This commit is contained in:
		| @@ -2,6 +2,8 @@ package middleware | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
|  | ||||
| 	"tydata-server/app/user/cmd/api/internal/config" | ||||
| @@ -47,8 +49,10 @@ func (m *AuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.HandlerFu | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| 		// 将用户ID添加到请求上下文 | ||||
| 		ctx := context.WithValue(r.Context(), ctxdata.CtxKeyJwtUserId, userId) | ||||
| 		// 将用户ID转换为json.Number类型后添加到请求上下文 | ||||
| 		userIdStr := fmt.Sprintf("%d", userId) | ||||
| 		userIdJsonNum := json.Number(userIdStr) | ||||
| 		ctx := context.WithValue(r.Context(), ctxdata.CtxKeyJwtUserId, userIdJsonNum) | ||||
|  | ||||
| 		// 使用新的上下文继续处理请求 | ||||
| 		next(w, r.WithContext(ctx)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user