Commit f8f292f0 authored by jiaorz's avatar jiaorz

Merge branch 'master-captcha-branch' into dev

parents c1889f48 597862ec
......@@ -4,9 +4,6 @@ import java.io.Serializable;
/**
* 验证码返回基础对象
* @author stx
* @date 2018/11/5 11:14
* @desc
*/
public class CaptchaBaseVO implements Serializable {
......
package com.xxfc.platform.universal.vo;
import lombok.Data;
import java.awt.*;
import java.util.List;
/**
* @author stx
* @date 2018/11/5 16:27
* @desc
*/
@Data
public class ClickWordCaptchaVO extends CaptchaBaseVO {
/** 点选文字 */
......@@ -16,19 +15,7 @@ public class ClickWordCaptchaVO extends CaptchaBaseVO {
/** 点选坐标 */
private List<Point> pointList;
public List<String> getWordList() {
return wordList;
}
public void setWordList(List<String> wordList) {
this.wordList = wordList;
}
public List<Point> getPointList() {
return pointList;
}
private Integer width;
private Integer height;
public void setPointList(List<Point> pointList) {
this.pointList = pointList;
}
}
......@@ -63,6 +63,7 @@ public class CaptchaController {
Boolean suc = redisTemplate.opsForValue().setIfAbsent(redisLockKey, JSONArray.toJSONString(dataVO.getPointList()));
if (suc) {
redisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期
dataVO.setPointList(null);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
......@@ -82,6 +83,7 @@ public class CaptchaController {
String redisLockKey = RedisKey.CAPTCHA_PHONE_PREFIX + phone;
String captchaCode = redisTemplate.opsForValue().get(redisLockKey) == null ? "" : redisTemplate.opsForValue().get(redisLockKey).toString();
log.info("【注册验证码坐标】:》》》》》 {}", captchaCode);
log.info("【注册验证码用户点选坐标】:》》》》》 {}", pointList);
if (StringUtils.isBlank(captchaCode)) {
log.error("【注册验证码坐标为空,请重新验证】");
return ObjectRestResponse.succ(false);
......
......@@ -17,9 +17,7 @@ import java.util.List;
/**
* 图行验证码抽象方法
* @author stx
* @date 2018/10/26 22:19
* @desc
*/
public abstract class AbstractCaptcha {
protected static final String URL_PREFIX_HTTP = "http://";
......
......@@ -18,9 +18,6 @@ import java.util.Set;
/**
* 点选文字验证码
* @author stx
* @date 2018/11/5 11:13
* @desc
*/
public class ClickWordCaptcha extends AbstractCaptcha {
......@@ -76,7 +73,8 @@ public class ClickWordCaptcha extends AbstractCaptcha {
Graphics backgroundGraphics = backgroundImage.getGraphics();
int width = backgroundImage.getWidth();
int height = backgroundImage.getHeight();
dataVO.setWidth(width);
dataVO.setHeight(height);
Font font = new Font(HAN_ZI_FONT, Font.BOLD, HAN_ZI_SIZE);
int wordCount = getWordTotalCount();
//定义随机1到arr.length某一个字不参与校验
......
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