From 949848c3dbb7ccfbd0453564fc35586fa531122e Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Wed, 10 Apr 2019 20:47:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=85=88=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/service/MobileCodeServiceImpl.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/MobileCodeServiceImpl.java b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/MobileCodeServiceImpl.java index c8b000cda..4bc2c6669 100644 --- a/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/MobileCodeServiceImpl.java +++ b/user/user-service-impl/src/main/java/cn/iocoder/mall/user/biz/service/MobileCodeServiceImpl.java @@ -50,20 +50,23 @@ public class MobileCodeServiceImpl implements MobileCodeService { * @return 手机验证码信息 */ public CommonResult validLastMobileCode(String mobile, String code) { - MobileCodeDO mobileCodePO = mobileCodeMapper.selectLast1ByMobile(mobile); - if (mobileCodePO == null) { // 若验证码不存在,抛出异常 - return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_FOUND.getCode()); - } - if (System.currentTimeMillis() - mobileCodePO.getCreateTime().getTime() >= codeExpireTimes) { // 验证码已过期 - return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_EXPIRED.getCode()); - } - if (mobileCodePO.getUsed()) { // 验证码已使用 - return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_USED.getCode()); - } - if (!mobileCodePO.getCode().equals(code)) { - return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_CORRECT.getCode()); - } - return CommonResult.success(mobileCodePO); + + // TODO: 2019-04-09 Sin 暂时先忽略掉验证码校验 + return CommonResult.success(new MobileCodeDO().setCode(code).setCreateTime(new Date()).setId(1)); +// MobileCodeDO mobileCodePO = mobileCodeMapper.selectLast1ByMobile(mobile); +// if (mobileCodePO == null) { // 若验证码不存在,抛出异常 +// return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_FOUND.getCode()); +// } +// if (System.currentTimeMillis() - mobileCodePO.getCreateTime().getTime() >= codeExpireTimes) { // 验证码已过期 +// return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_EXPIRED.getCode()); +// } +// if (mobileCodePO.getUsed()) { // 验证码已使用 +// return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_USED.getCode()); +// } +// if (!mobileCodePO.getCode().equals(code)) { +// return ServiceExceptionUtil.error(UserErrorCodeEnum.MOBILE_CODE_NOT_CORRECT.getCode()); +// } +// return CommonResult.success(mobileCodePO); } /**