From 688624299e31d8f6f1df1d82e25662339c29715b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=90=89=E5=85=86?= <303176530@qq.com> Date: Mon, 25 Oct 2021 22:01:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=8E=E5=A4=B4=E9=83=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E6=95=B4=E7=90=86=20=E5=A2=9E=E5=8A=A0=E4=B8=8D=E9=89=B4?= =?UTF-8?q?=E6=9D=83=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/middleware/casbin_rbac.go | 2 +- server/middleware/email.go | 4 ++-- server/middleware/operation.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/middleware/casbin_rbac.go b/server/middleware/casbin_rbac.go index ba10248c..b21345ec 100644 --- a/server/middleware/casbin_rbac.go +++ b/server/middleware/casbin_rbac.go @@ -13,7 +13,7 @@ var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService // 拦截器 func CasbinHandler() gin.HandlerFunc { return func(c *gin.Context) { - waitUse := utils.GetClaims(c) + waitUse, _ := utils.GetClaims(c) // 获取请求的URI obj := c.Request.URL.RequestURI() // 获取请求方法 diff --git a/server/middleware/email.go b/server/middleware/email.go index 6493ecbc..3f10db62 100644 --- a/server/middleware/email.go +++ b/server/middleware/email.go @@ -19,8 +19,8 @@ var userService = service.ServiceGroupApp.SystemServiceGroup.UserService func ErrorToEmail() gin.HandlerFunc { return func(c *gin.Context) { var username string - claims := utils2.GetClaims(c) - if claims.Username !="" { + claims, _ := utils2.GetClaims(c) + if claims.Username != "" { username = claims.Username } else { id, _ := strconv.Atoi(c.Request.Header.Get("x-user-id")) diff --git a/server/middleware/operation.go b/server/middleware/operation.go index 0931aa8f..9e4b6c18 100644 --- a/server/middleware/operation.go +++ b/server/middleware/operation.go @@ -30,7 +30,7 @@ func OperationRecord() gin.HandlerFunc { c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) } } - claims := utils.GetClaims(c) + claims, _ := utils.GetClaims(c) if claims.ID != 0 { userId = int(claims.ID) } else {