短信验证重写方法修改

This commit is contained in:
syruan 2023-12-14 10:59:03 +08:00
parent 171bea8437
commit 07d826f2d3
3 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ public interface RemoteUserService
* 验证码校验
*/
@PostMapping("/sms/checkCode")
public Boolean checkCode(@RequestParam("phone") String phone, @RequestParam("code") String code);
public R<Boolean> checkCode(@RequestParam("phone") String phone, @RequestParam("code") String code);
/**
* 注册用户信息

View File

@ -43,8 +43,8 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
}
@Override
public Boolean checkCode(String phone, String code) {
return false;
public R<Boolean> checkCode(String phone, String code) {
return R.fail("校验验证码失败:" + throwable.getMessage());
}
@Override

View File

@ -143,7 +143,7 @@ public class SysLoginService
recordLogService.recordLogininfor(phone, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + phone + " 已停用");
}
if (!remoteUserService.checkCode(phone, code)) {
if (remoteUserService.checkCode(phone, code).getCode() != Constants.SUCCESS) {
throw new ServiceException("对不起,您输入的验证码:" + code + " 不存在");
} else {
recordLogService.recordLogininfor(phone, Constants.LOGIN_SUCCESS, "登录成功");