From 1a938f83c3f141c93df8ef803f8dc1773ac2cfc9 Mon Sep 17 00:00:00 2001 From: shaoyongjun Date: Sun, 18 Aug 2024 18:24:26 +0800 Subject: [PATCH] to:sync --- service/third_login.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/third_login.go b/service/third_login.go index 3f29d50..9e2c3e9 100644 --- a/service/third_login.go +++ b/service/third_login.go @@ -4,6 +4,7 @@ import ( "ai-gateway/common/constant" "ai-gateway/common/dto" "ai-gateway/common/email" + "ai-gateway/common/logs" "ai-gateway/common/utils" "ai-gateway/infrastructure/redis" "ai-gateway/infrastructure/repository" @@ -49,7 +50,7 @@ func (l login) Register(ctx context.Context, req dto.ThirdRegisterReq) error { } func (l login) Login(ctx context.Context, req dto.ThirdLoginReq) (string, error) { - + start := time.Now().UnixMilli() //1. 验证账号密码 h := sha256.Sum256([]byte(req.Password)) passHash := hex.EncodeToString(h[:]) @@ -81,6 +82,8 @@ func (l login) Login(ctx context.Context, req dto.ThirdLoginReq) (string, error) gUserToken.ExpireTime = thirdUserToken.ExpireTime repository.GUserToken.UpdateUserLoginToken(ctx, gUserToken) + diff := time.Now().UnixMilli() - start + logs.NewLog("").Infof("Login cost: %d", diff) return l.GenAccessToken(gUserToken), nil }