Commit 4056af43 authored by jiaorz's avatar jiaorz

验证码图片问题

parent 1054e1e6
...@@ -57,9 +57,14 @@ public class CaptchaController { ...@@ -57,9 +57,14 @@ public class CaptchaController {
captchaBaseParam.setUrlOrPath(ImageUtils.getClickWordBgPath()); captchaBaseParam.setUrlOrPath(ImageUtils.getClickWordBgPath());
captcha.setFontColorRandom(false); captcha.setFontColorRandom(false);
ClickWordCaptchaVO dataVO = (ClickWordCaptchaVO) captcha.create(captchaBaseParam); ClickWordCaptchaVO dataVO = (ClickWordCaptchaVO) captcha.create(captchaBaseParam);
log.info("获取注册验证码:》》》{}", dataVO.getPointList());
if (dataVO.getPointList() != null) { if (dataVO.getPointList() != null) {
try { try {
String redisLockKey = RedisKey.CAPTCHA_PHONE_PREFIX + phone; String redisLockKey = RedisKey.CAPTCHA_PHONE_PREFIX + phone;
String captchaCode = redisTemplate.opsForValue().get(redisLockKey) == null ? "" : redisTemplate.opsForValue().get(redisLockKey).toString();
if (StringUtils.isNotBlank(captchaCode)) {
redisTemplate.delete(redisLockKey);
}
Boolean suc = redisTemplate.opsForValue().setIfAbsent(redisLockKey, JSONArray.toJSONString(dataVO.getPointList())); Boolean suc = redisTemplate.opsForValue().setIfAbsent(redisLockKey, JSONArray.toJSONString(dataVO.getPointList()));
if (suc) { if (suc) {
redisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期 redisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment