重构 resource 模块,支持自定义tag标签

重构 transform 模块
修复以及优化各验证码生成器,
This commit is contained in:
天爱有情
2023-02-13 14:29:11 +08:00
parent ebc39efb02
commit 37d88b5ec2
25 changed files with 518 additions and 346 deletions
@@ -1,6 +1,7 @@
package cloud.tianai.captcha.resource.impl;
import cloud.tianai.captcha.resource.ImageCaptchaResourceManager;
import cloud.tianai.captcha.resource.common.model.dto.ResourceMap;
import cloud.tianai.captcha.resource.impl.provider.URLResourceProvider;
import cloud.tianai.captcha.resource.ImageCaptchaResourceManager;
import cloud.tianai.captcha.resource.ResourceProvider;
@@ -49,8 +50,8 @@ public class DefaultImageCaptchaResourceManager implements ImageCaptchaResourceM
}
@Override
public Map<String, Resource> randomGetTemplate(String type) {
Map<String, Resource> resourceMap = resourceStore.randomGetTemplateByType(type);
public ResourceMap randomGetTemplate(String type, String tag) {
ResourceMap resourceMap = resourceStore.randomGetTemplateByTypeAndTag(type, tag);
if (resourceMap == null) {
throw new IllegalStateException("随机获取模板错误,store中模板为空, type:" + type);
}
@@ -58,8 +59,8 @@ public class DefaultImageCaptchaResourceManager implements ImageCaptchaResourceM
}
@Override
public Resource randomGetResource(String type) {
Resource resource = resourceStore.randomGetResource(type);
public Resource randomGetResource(String type, String tag) {
Resource resource = resourceStore.randomGetResourceByTypeAndTag(type, tag);
if (resource == null) {
throw new IllegalStateException("随机获取资源错误,store中资源为空, type:" + type);
}