From fed369ad5dd7b1a74b394af1c964aed0ee10889d Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Sat, 7 May 2022 12:04:07 +0800 Subject: [PATCH] add err log --- internal/cms_api/middleware/jwt_auth.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/cms_api/middleware/jwt_auth.go b/internal/cms_api/middleware/jwt_auth.go index a6f1af993..255e3eaaf 100644 --- a/internal/cms_api/middleware/jwt_auth.go +++ b/internal/cms_api/middleware/jwt_auth.go @@ -11,14 +11,16 @@ import ( func JWTAuth() gin.HandlerFunc { return func(c *gin.Context) { - ok, userID := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "") + ok, userID, errInfo := token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), "") log.NewInfo("0", utils.GetSelfFuncName(), "userID: ", userID) c.Set("userID", userID) if !ok { - log.NewError("","GetUserIDFromToken false ", c.Request.Header.Get("token")) + log.NewError("", "GetUserIDFromToken false ", c.Request.Header.Get("token")) c.Abort() http.RespHttp200(c, constant.ErrParseToken, nil) return + } else { + log.NewInfo("0", utils.GetSelfFuncName(), "failed: ", errInfo) } } }