@@ -23,7 +23,7 @@ func GetUserId(c *gin.Context) int {
2323 if data ["identity" ] != nil {
2424 return int ((data ["identity" ]).(float64 ))
2525 }
26- fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetUserId 缺少identity " )
26+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetUserId 缺少 identity " )
2727 return 0
2828}
2929
@@ -32,7 +32,7 @@ func GetUserIdStr(c *gin.Context) string {
3232 if data ["identity" ] != nil {
3333 return pkg .Int64ToString (int64 ((data ["identity" ]).(float64 )))
3434 }
35- fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetUserIdStr 缺少identity " )
35+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetUserIdStr 缺少 identity " )
3636 return ""
3737}
3838
@@ -41,7 +41,7 @@ func GetUserName(c *gin.Context) string {
4141 if data ["nice" ] != nil {
4242 return (data ["nice" ]).(string )
4343 }
44- fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetUserName 缺少nice " )
44+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetUserName 缺少 nice " )
4545 return ""
4646}
4747
@@ -50,7 +50,7 @@ func GetRoleName(c *gin.Context) string {
5050 if data ["rolekey" ] != nil {
5151 return (data ["rolekey" ]).(string )
5252 }
53- fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetRoleName 缺少rolekey " )
53+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetRoleName 缺少 rolekey " )
5454 return ""
5555}
5656
@@ -60,6 +60,25 @@ func GetRoleId(c *gin.Context) int {
6060 i := int ((data ["roleid" ]).(float64 ))
6161 return i
6262 }
63- fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetRoleId 缺少roleid " )
63+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetRoleId 缺少 roleid " )
6464 return 0
6565}
66+
67+ func GetDeptId (c * gin.Context ) int {
68+ data := ExtractClaims (c )
69+ if data ["deptid" ] != nil {
70+ i := int ((data ["deptid" ]).(float64 ))
71+ return i
72+ }
73+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetDeptId 缺少 deptid" )
74+ return 0
75+ }
76+
77+ func GetDeptName (c * gin.Context ) string {
78+ data := ExtractClaims (c )
79+ if data ["deptkey" ] != nil {
80+ return (data ["deptkey" ]).(string )
81+ }
82+ fmt .Println (pkg .GetCurrentTimeStr () + " [WARING] " + c .Request .Method + " " + c .Request .URL .Path + " GetDeptName 缺少 deptkey" )
83+ return ""
84+ }
0 commit comments