From 6a9bfa3f4cfe76a49aedd5adfcb71226151d545d Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 25 Nov 2024 13:57:02 +0800 Subject: [PATCH] update --- app/hdl/comm/hdl_comm.go | 18 ++---------------- app/svc/svc_auth.go | 1 + 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/hdl/comm/hdl_comm.go b/app/hdl/comm/hdl_comm.go index 8e1a1b8..9531b9a 100644 --- a/app/hdl/comm/hdl_comm.go +++ b/app/hdl/comm/hdl_comm.go @@ -4,6 +4,7 @@ import ( "applet/app/db" "applet/app/e" "applet/app/md/comm" + "applet/app/svc" "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "code.fnuoos.com/EggPlanet/egg_models.git/src/model" @@ -84,22 +85,7 @@ func AccessRecords(c *gin.Context) { return } - if req.Index == "" { - e.OutErr(c, e.ERR_INVALID_ARGS, nil) - return - } - - val, exists := c.Get("user") - if !exists { - e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) - return - } - user, ok := val.(*model.User) - if !ok { - e.OutErr(c, e.ERR_USER_CHECK_ERR, nil) - return - } - + user := svc.GetUser(c) date := time.Now().Format("2006-01-02") recordsDb := implement.NewEggAccessRecordsDb(db.Db) exist, err := recordsDb.EggAccessRecordsExist(user.Id, date, req.Index) diff --git a/app/svc/svc_auth.go b/app/svc/svc_auth.go index 1624316..065a3e8 100644 --- a/app/svc/svc_auth.go +++ b/app/svc/svc_auth.go @@ -59,6 +59,7 @@ func CheckUser(c *gin.Context) (user *model.User, newToken string, err error) { if err != nil { return user, newToken, err } + // 3、获取用户信息 //userInfoProvider := provider.GetUserInfoProvider() userInfoProvider := provider.NewUserInfoProvider()