Skip to content

Commit

Permalink
🔖 Releasing / Version tags. 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwNB committed Oct 4, 2020
1 parent 0053ba4 commit ff8662a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 217 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
### 3.1.gradle方式的引入
```text
dependencies {
compile 'com.pig4cloud.plugin:easy-captcha:1.6.2'
compile 'com.pig4cloud.plugin:easy-captcha:2.2.0'
}
```

Expand All @@ -65,7 +65,7 @@ dependencies {
<dependency>
<groupId>com.pig4cloud.plugin</groupId>
<artifactId>easy-captcha</artifactId>
<version>1.6.2</version>
<version>2.2.0</version>
</dependency>
</dependencies>
```
Expand Down
5 changes: 5 additions & 0 deletions captcha-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.aviator</groupId>
<artifactId>aviator</artifactId>
<version>5.1.4</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.pig4cloud.captcha;

import com.googlecode.aviator.AviatorEvaluator;
import com.pig4cloud.captcha.base.ArithmeticCaptchaAbstract;
import com.pig4cloud.captcha.engine.Evaluator;

import javax.imageio.ImageIO;
import java.awt.*;
Expand Down Expand Up @@ -127,7 +127,7 @@ else if (type == 2) {
}
}
}
chars = String.valueOf(Evaluator.eval(sb.toString()));
chars = String.valueOf(AviatorEvaluator.execute(sb.toString()));

int parseInt = Integer.parseInt(chars);
if (parseInt < 0) {
Expand All @@ -145,8 +145,7 @@ else if (type == 2) {
sb.append(num(0, parseInt + 1));
}
}

chars = String.valueOf(Evaluator.eval(sb.toString()));
chars = String.valueOf(AviatorEvaluator.execute(sb.toString()));
sb.append("=?");
setArithmeticString(sb.toString());
return chars.toCharArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.pig4cloud.captcha.base;

import com.pig4cloud.captcha.engine.Evaluator;
import com.googlecode.aviator.AviatorEvaluator;
import com.pig4cloud.captcha.engine.Symbol;

/**
Expand All @@ -19,6 +19,7 @@ public ArithmeticCaptchaAbstract() {

/**
* 生成随机验证码
*
* @return 验证码字符数组
*/
@Override
Expand All @@ -30,16 +31,15 @@ protected char[] alphas() {
int type = num(1, algorithmSign);
if (type == 1) {
sb.append(Symbol.ADD.getValue());
}
else if (type == 2) {
} else if (type == 2) {
sb.append(Symbol.SUB.getValue());
}
else if (type == 3) {
} else if (type == 3) {
sb.append(Symbol.MUL.getValue());
}
}
}
chars = String.valueOf(Evaluator.eval(sb.toString()));

chars = String.valueOf(AviatorEvaluator.execute(sb.toString().replace("x", "*")));
sb.append("=?");
arithmeticString = sb.toString();
return chars.toCharArray();
Expand All @@ -59,7 +59,9 @@ public void setDifficulty(int difficulty) {
}

/**
* algorithmSign 2 : 支持加法 algorithmSign 3 : 支持加减法 algorithmSign 4 : 支持加减乘法
* algorithmSign
* 2 : 支持加法 algorithmSign 3 : 支持加减法 algorithmSign 4 : 支持加减乘法
*
* @param algorithmSign 计算公式标示
*/
public void supportAlgorithmSign(int algorithmSign) {
Expand Down
151 changes: 0 additions & 151 deletions captcha-core/src/main/java/com/pig4cloud/captcha/engine/Evaluator.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum Symbol {
/**
* 标识符
*/
NUM('n', false), ADD('+', false), SUB('-', false), MUL('×', true), DIV('÷', true);
NUM('n', false), ADD('+', false), SUB('-', false), MUL('x', true), DIV('÷', true);

private final char value;

Expand Down
52 changes: 0 additions & 52 deletions captcha-core/src/main/java/com/pig4cloud/captcha/engine/Token.java

This file was deleted.

0 comments on commit ff8662a

Please sign in to comment.