From f65ce9c19568745003b22e82060fb38c2885c701 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期五, 13 十月 2023 15:36:30 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/crm --- utils/clamis.go | 24 ++++++------------------ 1 files changed, 6 insertions(+), 18 deletions(-) diff --git a/utils/clamis.go b/utils/clamis.go index 1e10801..305d0ce 100644 --- a/utils/clamis.go +++ b/utils/clamis.go @@ -22,30 +22,18 @@ return claims, err } -// GetUserID 浠嶨in鐨凜ontext涓幏鍙栦粠jwt瑙f瀽鍑烘潵鐨勭敤鎴稩D -func GetUserID(c *gin.Context) string { - if claims, exists := c.Get("claims"); !exists { - if cl, err := GetClaims(c); err != nil { - return "" - } else { - return cl.UserId - } - } else { +func GetUserID(c *gin.Context) int { + if claims, exists := c.Get("claims"); exists { waitUse := claims.(*request.CustomClaims) - return waitUse.UserId + return waitUse.CrmUserId } + return 0 } -// GetUserInfo 浠嶨in鐨凜ontext涓幏鍙栦粠jwt瑙f瀽鍑烘潵鐨勭敤鎴蜂俊鎭� func GetUserInfo(c *gin.Context) *request.CustomClaims { - if claims, exists := c.Get("claims"); !exists { - if cl, err := GetClaims(c); err != nil { - return nil - } else { - return cl - } - } else { + if claims, exists := c.Get("claims"); exists { waitUse := claims.(*request.CustomClaims) return waitUse } + return nil } -- Gitblit v1.8.0