From 699877a9697d5be1d32a1690808639552b1ef3a2 Mon Sep 17 00:00:00 2001 From: shaoyongjun Date: Wed, 15 May 2024 17:29:08 +0800 Subject: [PATCH] to:sync --- common/config/config.dev.yaml | 2 +- infrastructure/repository/g_account_repository.go | 5 +++++ service/third_login.go | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/config/config.dev.yaml b/common/config/config.dev.yaml index 827203a..d2ac616 100644 --- a/common/config/config.dev.yaml +++ b/common/config/config.dev.yaml @@ -15,7 +15,7 @@ rpc: # mysql mysql: logSql: true - dsn: uc:zELLqwk2hBp8QyJgEtH5YGc6WKMS3dXP@tcp(43.133.218.116:10119)/user_center?charset=utf8mb4&parseTime=True&loc=Local + dsn: uc:zELLqwk2hBp8QyJgEtH5YGc6WKMS3dXP@tcp(123.207.198.132:10119)/user_center?charset=utf8mb4&parseTime=True&loc=Local maxIdleConn: 4 maxOpenConn: 4 connMaxLifetime: 3000 diff --git a/infrastructure/repository/g_account_repository.go b/infrastructure/repository/g_account_repository.go index 3905ef0..9b20d7c 100644 --- a/infrastructure/repository/g_account_repository.go +++ b/infrastructure/repository/g_account_repository.go @@ -33,6 +33,11 @@ type gUserRepositoryImpl struct { // FindByAccount 根据 account 和 pwd 查询用户 func (gUserRepositoryImpl) FindByAccount(ctx context.Context, account string) *AccountDO { + //验证参数 + if account == "" { + + } + db, ok := ctx.Value("db").(*gorm.DB) if !ok { db = Db diff --git a/service/third_login.go b/service/third_login.go index 697642f..3f29d50 100644 --- a/service/third_login.go +++ b/service/third_login.go @@ -49,6 +49,7 @@ func (l login) Register(ctx context.Context, req dto.ThirdRegisterReq) error { } func (l login) Login(ctx context.Context, req dto.ThirdLoginReq) (string, error) { + //1. 验证账号密码 h := sha256.Sum256([]byte(req.Password)) passHash := hex.EncodeToString(h[:]) @@ -79,6 +80,7 @@ func (l login) Login(ctx context.Context, req dto.ThirdLoginReq) (string, error) gUserToken.AccessToken = thirdUserToken.AccessToken gUserToken.ExpireTime = thirdUserToken.ExpireTime repository.GUserToken.UpdateUserLoginToken(ctx, gUserToken) + return l.GenAccessToken(gUserToken), nil }