暂时先忽略错误码

pull/1/head
sin 2019-04-10 20:47:02 +08:00
parent 6d3fe11b17
commit 949848c3db
1 changed files with 17 additions and 14 deletions

View File

@ -50,20 +50,23 @@ public class MobileCodeServiceImpl implements MobileCodeService {
* @return * @return
*/ */
public CommonResult<MobileCodeDO> validLastMobileCode(String mobile, String code) { public CommonResult<MobileCodeDO> validLastMobileCode(String mobile, String code) {
MobileCodeDO mobileCodePO = mobileCodeMapper.selectLast1ByMobile(mobile);
if (mobileCodePO == null) { // 若验证码不存在,抛出异常 // TODO: 2019-04-09 Sin 暂时先忽略掉验证码校验
return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_FOUND.getCode()); return CommonResult.success(new MobileCodeDO().setCode(code).setCreateTime(new Date()).setId(1));
} // MobileCodeDO mobileCodePO = mobileCodeMapper.selectLast1ByMobile(mobile);
if (System.currentTimeMillis() - mobileCodePO.getCreateTime().getTime() >= codeExpireTimes) { // 验证码已过期 // if (mobileCodePO == null) { // 若验证码不存在,抛出异常
return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_EXPIRED.getCode()); // return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_FOUND.getCode());
} // }
if (mobileCodePO.getUsed()) { // 验证码已使用 // if (System.currentTimeMillis() - mobileCodePO.getCreateTime().getTime() >= codeExpireTimes) { // 验证码已过期
return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_USED.getCode()); // return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_EXPIRED.getCode());
} // }
if (!mobileCodePO.getCode().equals(code)) { // if (mobileCodePO.getUsed()) { // 验证码已使用
return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_CORRECT.getCode()); // return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_USED.getCode());
} // }
return CommonResult.success(mobileCodePO); // if (!mobileCodePO.getCode().equals(code)) {
// return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_CORRECT.getCode());
// }
// return CommonResult.success(mobileCodePO);
} }
/** /**