From 9ecc26187ebdfaf70c1ef7a8a16f50f7729f4427 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 30 Aug 2023 14:38:56 +0800 Subject: [PATCH] update --- app/customer/hdl/hdl_user.go | 2 -- app/customer/mw/mw_customer_auth.go | 4 ++++ app/customer/svc/svc_auth.go | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index 0703c4e..d64b63a 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -7,7 +7,6 @@ import ( "applet/app/e" "applet/app/enum" "applet/app/utils" - "fmt" "github.com/gin-gonic/gin" "time" ) @@ -15,7 +14,6 @@ import ( func UserInfo(c *gin.Context) { //1、获取用户信息 userInfo := svc.GetUser(c) - fmt.Println(">>>>>>>>>>>>>userInfo", userInfo) //2、获取用户身份信息 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(userInfo.Id) diff --git a/app/customer/mw/mw_customer_auth.go b/app/customer/mw/mw_customer_auth.go index 75f54e0..a4f1abd 100644 --- a/app/customer/mw/mw_customer_auth.go +++ b/app/customer/mw/mw_customer_auth.go @@ -20,6 +20,10 @@ func Auth(c *gin.Context) { return } } + if user == nil { + e.OutErr(c, e.ERR_NOT_AUTH, "当前用户信息失效") + return + } // 将当前请求的username信息保存到请求的上下文c上 c.Set("user", user) c.Next() diff --git a/app/customer/svc/svc_auth.go b/app/customer/svc/svc_auth.go index ae6bdc9..d364589 100644 --- a/app/customer/svc/svc_auth.go +++ b/app/customer/svc/svc_auth.go @@ -5,7 +5,6 @@ import ( "applet/app/db" "applet/app/db/model" "errors" - "fmt" "github.com/gin-gonic/gin" "strings" "time" @@ -13,7 +12,6 @@ import ( func GetUser(c *gin.Context) *model.User { user, _ := c.Get("user") - fmt.Println("user>>>>>>>>>", user) if user == nil { return &model.User{ Id: 0,