From 4a23356a5840b624c81dda44b0028ed8fc3656cc Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 13 十月 2023 11:14:25 +0800 Subject: [PATCH] 销售线索简单数据权限 --- 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