feat(user): mobilecodeloginlogic修正
This commit is contained in:
parent
9a589352d9
commit
1604950f31
@ -47,11 +47,11 @@ func (l *MobileCodeLoginLogic) MobileCodeLogin(req *types.MobileCodeLoginReq) (r
|
|||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "手机登录, 读取数据库获取用户失败, mobile: %s, err: %+v", req.Mobile, err)
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "手机登录, 读取数据库获取用户失败, mobile: %s, err: %+v", req.Mobile, err)
|
||||||
}
|
}
|
||||||
if user == nil {
|
if user == nil {
|
||||||
|
user = &model.User{Mobile: req.Mobile}
|
||||||
|
if len(user.Nickname) == 0 {
|
||||||
|
user.Nickname = req.Mobile
|
||||||
|
}
|
||||||
if transErr := l.svcCtx.UserModel.Trans(l.ctx, func(ctx context.Context, session sqlx.Session) error {
|
if transErr := l.svcCtx.UserModel.Trans(l.ctx, func(ctx context.Context, session sqlx.Session) error {
|
||||||
user.Mobile = req.Mobile
|
|
||||||
if len(user.Nickname) == 0 {
|
|
||||||
user.Nickname = req.Mobile
|
|
||||||
}
|
|
||||||
insertResult, userInsertErr := l.svcCtx.UserModel.Insert(ctx, session, user)
|
insertResult, userInsertErr := l.svcCtx.UserModel.Insert(ctx, session, user)
|
||||||
if userInsertErr != nil {
|
if userInsertErr != nil {
|
||||||
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "手机注册, 数据库插入新用户失败, mobile%s, err: %+v", req.Mobile, err)
|
return errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "手机注册, 数据库插入新用户失败, mobile%s, err: %+v", req.Mobile, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user