修复 "使用手机 + 验证码登录"功能中存在服务间调用异常被吃掉从而导致无法正常响应异常信息

pull/100/head^2
YunaiV 2024-02-27 21:05:26 +08:00
parent dcc2881960
commit 8537964e82
3 changed files with 6 additions and 6 deletions

View File

@ -82,7 +82,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
public AppAuthLoginRespVO smsLogin(AppAuthSmsLoginReqVO reqVO) { public AppAuthLoginRespVO smsLogin(AppAuthSmsLoginReqVO reqVO) {
// 校验验证码 // 校验验证码
String userIp = getClientIP(); String userIp = getClientIP();
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_LOGIN.getScene(), userIp)); smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_LOGIN.getScene(), userIp)).getCheckedData();
// 获得获得注册用户 // 获得获得注册用户
MemberUserDO user = userService.createUserIfAbsent(reqVO.getMobile(), userIp, getTerminal()); MemberUserDO user = userService.createUserIfAbsent(reqVO.getMobile(), userIp, getTerminal());

View File

@ -158,11 +158,11 @@ public class MemberUserServiceImpl implements MemberUserService {
// 补充说明:从安全性来说,老手机也校验 oldCode 验证码会更安全。但是由于 uni-app 商城界面暂时没做,所以这里不强制校验 // 补充说明:从安全性来说,老手机也校验 oldCode 验证码会更安全。但是由于 uni-app 商城界面暂时没做,所以这里不强制校验
if (StrUtil.isNotEmpty(reqVO.getOldCode())) { if (StrUtil.isNotEmpty(reqVO.getOldCode())) {
smsCodeApi.useSmsCode(new SmsCodeUseReqDTO().setMobile(user.getMobile()).setCode(reqVO.getOldCode()) smsCodeApi.useSmsCode(new SmsCodeUseReqDTO().setMobile(user.getMobile()).setCode(reqVO.getOldCode())
.setScene(SmsSceneEnum.MEMBER_UPDATE_MOBILE.getScene()).setUsedIp(getClientIP())); .setScene(SmsSceneEnum.MEMBER_UPDATE_MOBILE.getScene()).setUsedIp(getClientIP())).getCheckedData();
} }
// 2.2 使用新验证码 // 2.2 使用新验证码
smsCodeApi.useSmsCode(new SmsCodeUseReqDTO().setMobile(reqVO.getMobile()).setCode(reqVO.getCode()) smsCodeApi.useSmsCode(new SmsCodeUseReqDTO().setMobile(reqVO.getMobile()).setCode(reqVO.getCode())
.setScene(SmsSceneEnum.MEMBER_UPDATE_MOBILE.getScene()).setUsedIp(getClientIP())); .setScene(SmsSceneEnum.MEMBER_UPDATE_MOBILE.getScene()).setUsedIp(getClientIP())).getCheckedData();
// 3. 更新用户手机 // 3. 更新用户手机
memberUserMapper.updateById(MemberUserDO.builder().id(userId).mobile(reqVO.getMobile()).build()); memberUserMapper.updateById(MemberUserDO.builder().id(userId).mobile(reqVO.getMobile()).build());
@ -187,7 +187,7 @@ public class MemberUserServiceImpl implements MemberUserService {
MemberUserDO user = validateUserExists(userId); MemberUserDO user = validateUserExists(userId);
// 校验验证码 // 校验验证码
smsCodeApi.useSmsCode(new SmsCodeUseReqDTO().setMobile(user.getMobile()).setCode(reqVO.getCode()) smsCodeApi.useSmsCode(new SmsCodeUseReqDTO().setMobile(user.getMobile()).setCode(reqVO.getCode())
.setScene(SmsSceneEnum.MEMBER_UPDATE_PASSWORD.getScene()).setUsedIp(getClientIP())); .setScene(SmsSceneEnum.MEMBER_UPDATE_PASSWORD.getScene()).setUsedIp(getClientIP())).getCheckedData();
// 更新用户密码 // 更新用户密码
memberUserMapper.updateById(MemberUserDO.builder().id(userId) memberUserMapper.updateById(MemberUserDO.builder().id(userId)
@ -201,7 +201,7 @@ public class MemberUserServiceImpl implements MemberUserService {
// 使用验证码 // 使用验证码
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_RESET_PASSWORD, smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_RESET_PASSWORD,
getClientIP())); getClientIP())).getCheckedData();
// 更新密码 // 更新密码
memberUserMapper.updateById(MemberUserDO.builder().id(user.getId()) memberUserMapper.updateById(MemberUserDO.builder().id(user.getId())

View File

@ -122,7 +122,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override @Override
public AuthLoginRespVO smsLogin(AuthSmsLoginReqVO reqVO) { public AuthLoginRespVO smsLogin(AuthSmsLoginReqVO reqVO) {
// 校验验证码 // 校验验证码
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.ADMIN_MEMBER_LOGIN.getScene(), getClientIP())); smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.ADMIN_MEMBER_LOGIN.getScene(), getClientIP())).getCheckedData();
// 获得用户信息 // 获得用户信息
AdminUserDO user = userService.getUserByMobile(reqVO.getMobile()); AdminUserDO user = userService.getUserByMobile(reqVO.getMobile());