fix
This commit is contained in:
parent
e092cee440
commit
0d0ad3bee8
@ -42,6 +42,13 @@ func (l *BindMobileLogic) BindMobile(req *types.BindMobileReq) (resp *types.Bind
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "绑定手机号, 加密手机号失败: %v", err)
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "绑定手机号, 加密手机号失败: %v", err)
|
||||||
}
|
}
|
||||||
|
user, err := l.svcCtx.UserModel.FindOneByMobile(l.ctx, sql.NullString{String: encryptedMobile, Valid: true})
|
||||||
|
if err != nil && !errors.Is(err, model.ErrNotFound) {
|
||||||
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "绑定手机号, %v", err)
|
||||||
|
}
|
||||||
|
if user != nil {
|
||||||
|
return nil, errors.Wrapf(xerr.NewErrMsg("该手机号已绑定"), "绑定手机号, %v", err)
|
||||||
|
}
|
||||||
// 检查手机号是否在一分钟内已发送过验证码
|
// 检查手机号是否在一分钟内已发送过验证码
|
||||||
redisKey := fmt.Sprintf("%s:%s", "bindMobile", encryptedMobile)
|
redisKey := fmt.Sprintf("%s:%s", "bindMobile", encryptedMobile)
|
||||||
cacheCode, err := l.svcCtx.Redis.Get(redisKey)
|
cacheCode, err := l.svcCtx.Redis.Get(redisKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user