to:sync
This commit is contained in:
parent
1de6800707
commit
699877a969
@ -15,7 +15,7 @@ rpc:
|
|||||||
# mysql
|
# mysql
|
||||||
mysql:
|
mysql:
|
||||||
logSql: true
|
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
|
maxIdleConn: 4
|
||||||
maxOpenConn: 4
|
maxOpenConn: 4
|
||||||
connMaxLifetime: 3000
|
connMaxLifetime: 3000
|
||||||
|
@ -33,6 +33,11 @@ type gUserRepositoryImpl struct {
|
|||||||
|
|
||||||
// FindByAccount 根据 account 和 pwd 查询用户
|
// FindByAccount 根据 account 和 pwd 查询用户
|
||||||
func (gUserRepositoryImpl) FindByAccount(ctx context.Context, account string) *AccountDO {
|
func (gUserRepositoryImpl) FindByAccount(ctx context.Context, account string) *AccountDO {
|
||||||
|
//验证参数
|
||||||
|
if account == "" {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
db, ok := ctx.Value("db").(*gorm.DB)
|
db, ok := ctx.Value("db").(*gorm.DB)
|
||||||
if !ok {
|
if !ok {
|
||||||
db = Db
|
db = Db
|
||||||
|
@ -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) {
|
func (l login) Login(ctx context.Context, req dto.ThirdLoginReq) (string, error) {
|
||||||
|
|
||||||
//1. 验证账号密码
|
//1. 验证账号密码
|
||||||
h := sha256.Sum256([]byte(req.Password))
|
h := sha256.Sum256([]byte(req.Password))
|
||||||
passHash := hex.EncodeToString(h[:])
|
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.AccessToken = thirdUserToken.AccessToken
|
||||||
gUserToken.ExpireTime = thirdUserToken.ExpireTime
|
gUserToken.ExpireTime = thirdUserToken.ExpireTime
|
||||||
repository.GUserToken.UpdateUserLoginToken(ctx, gUserToken)
|
repository.GUserToken.UpdateUserLoginToken(ctx, gUserToken)
|
||||||
|
|
||||||
return l.GenAccessToken(gUserToken), nil
|
return l.GenAccessToken(gUserToken), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user