提交 5aecbdac 编写于 作者: znn1980's avatar znn1980

update 验证码减法的错误

上级 2e6f75d8
......@@ -40,6 +40,9 @@ public class MasterViewController extends BaseViewController {
response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg");
String text = calcMathCaptcha.getProducer().createText();
if (logger.isInfoEnabled()) {
logger.info("验证码:{}", text);
}
masterUserService.setCaptcha(request.getSession(true), calcMathCaptcha.parseResult(text));
BufferedImage image = calcMathCaptcha.getProducer().createImage(calcMathCaptcha.parseText(text));
ImageIO.write(image, "jpg", response.getOutputStream());
......
......@@ -32,7 +32,7 @@ public class CalcMathTextCreator extends DefaultTextCreator {
} else if (calc == CALC_SUBTRACTION) {
//减法,交换位置不出现负数
result = x >= y ? x - y : y - x;
text.append(x >= y ? CALC_MATH_NUMBER[x] : CALC_MATH_NUMBER[y]).append(CALC_SYMBOL[CALC_SUBTRACTION]).append(x >= y ? CALC_MATH_NUMBER[x] : CALC_MATH_NUMBER[y]);
text.append(x >= y ? CALC_MATH_NUMBER[x] : CALC_MATH_NUMBER[y]).append(CALC_SYMBOL[CALC_SUBTRACTION]).append(x >= y ? CALC_MATH_NUMBER[y] : CALC_MATH_NUMBER[x]);
} else if (calc == CALC_MULTIPLICATION) {
//乘法
result = x * y;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册