1.5.0正式版

This commit is contained in:
天爱有情
2024-07-15 13:42:31 +08:00
parent 00ffd1910c
commit df81c15fc7
3 changed files with 10 additions and 4 deletions
+4 -2
View File
@@ -54,9 +54,11 @@ public class ApplicationTest {
public static void main(String[] args) { public static void main(String[] args) {
ImageCaptchaApplication application = TACBuilder.builder() ImageCaptchaApplication application = TACBuilder.builder()
.addDefaultTemplate() .addDefaultTemplate() // 添加默认模板
// 给滑块验证码 添加背景图片,宽高为600*360, Resource 参数1为 classpath/file/url , 参数2 为具体url // 给滑块验证码 添加背景图片,宽高为600*360, Resource 参数1为 classpath/file/url , 参数2 为具体url
.addResource("SLIDER", new Resource("classpath", "META-INF/cut-image/resource/1.jpg")) .addResource("SLIDER", new Resource("classpath", "META-INF/cut-image/resource/1.jpg")) // 滑块验证的背景图
.addResource("WORD_IMAGE_CLICK", new Resource("classpath", "META-INF/cut-image/resource/1.jpg")) // 文字点选的背景图
.addResource("ROTATE", new Resource("classpath", "META-INF/cut-image/resource/1.jpg")) // 旋转验证的背景图
.build(); .build();
// 生成验证码数据, 可以将该数据直接返回给前端 , 可配合 tianai-captcha-web-sdk 使用 // 生成验证码数据, 可以将该数据直接返回给前端 , 可配合 tianai-captcha-web-sdk 使用
// 支持生成 滑动验证码(SLIDER)、旋转验证码(ROTATE)、滑动还原验证码(CONCAT)、文字点选验证码(WORD_IMAGE_CLICK) // 支持生成 滑动验证码(SLIDER)、旋转验证码(ROTATE)、滑动还原验证码(CONCAT)、文字点选验证码(WORD_IMAGE_CLICK)
@@ -59,8 +59,10 @@ public class CacheImageCaptchaGenerator implements ImageCaptchaGenerator {
this.size = size; this.size = size;
this.waitTime = waitTime; this.waitTime = waitTime;
this.period = period; this.period = period;
if (expireTime != null){
this.expireTime = expireTime; this.expireTime = expireTime;
} }
}
/** /**
* 记的初始化调度器 * 记的初始化调度器
@@ -12,8 +12,10 @@ public class TACBuilderTest {
ImageCaptchaApplication application = TACBuilder.builder() ImageCaptchaApplication application = TACBuilder.builder()
.addDefaultTemplate() .addDefaultTemplate()
.addResource("SLIDER", new Resource("classpath", "META-INF/cut-image/resource/1.jpg")) .addResource("SLIDER", new Resource("classpath", "META-INF/cut-image/resource/1.jpg"))
.addResource("WORD_IMAGE_CLICK", new Resource("classpath", "META-INF/cut-image/resource/1.jpg"))
.addResource("ROTATE", new Resource("classpath", "META-INF/cut-image/resource/1.jpg"))
.build(); .build();
CaptchaResponse<ImageCaptchaVO> response = application.generateCaptcha("SLIDER"); CaptchaResponse<ImageCaptchaVO> response = application.generateCaptcha("ROTATE");
System.out.println(response); System.out.println(response);
} }