| | |
| | | } |
| | | String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(updatePhone.getNewPhone(), ""); |
| | | String captcha = redisService.getCacheObject(verifyKey); |
| | | if (captcha == null) { |
| | | String[] split = captcha.split(":"); |
| | | long l = Long.parseLong(split[2]); |
| | | long l1 = System.currentTimeMillis(); |
| | | // 判断是否大于两分钟 |
| | | if (l1 - l > 2 * 60 * 1000) { |
| | | throw new CaptchaException("验证码已失效"); |
| | | } |
| | | redisService.deleteObject(verifyKey); |
| | | if (captcha == null) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |
| | | if (!updatePhone.getCode().equalsIgnoreCase(captcha)) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |