From f768d69defc7929abd521ea578c52e72e4105b24 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 12 Jan 2021 13:22:03 +0800 Subject: [PATCH] =?UTF-8?q?feat=E2=9C=A8=20:=20=E6=B2=A1=E6=9C=89=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=9A=84=E6=8E=A5=E5=8F=A3=E4=BD=BF=E7=94=A8log?= =?UTF-8?q?=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/middleware/permission.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/admin/middleware/permission.go b/app/admin/middleware/permission.go index 6d8e303..81d2168 100644 --- a/app/admin/middleware/permission.go +++ b/app/admin/middleware/permission.go @@ -28,14 +28,17 @@ func AuthCheckRole() gin.HandlerFunc { } else { res, err = e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method) if err != nil { - log.Errorf("msgID[%s] error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path) + log.Errorf("msgID[%s] AuthCheckRole error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path) app.Error(c, 500, err, "") + return } } if res { + log.Infof("msgID[%s] isTrue: %v role: %s method: %s path: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path) c.Next() } else { + log.Warnf("msgID[%s] isTrue: %v role: %s method: %s path: %s message: %s", msgID, res, v["rolekey"], c.Request.Method, c.Request.URL.Path,"当前请求是没有接口权限的,请管理员确认!") c.JSON(http.StatusOK, gin.H{ "code": 403, "msg": "对不起,您没有该接口访问权限,请联系管理员",