mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-05-02 18:11:26 +08:00
update 优化api,gateway,auth代码结构
This commit is contained in:
@@ -59,11 +59,13 @@ public class CaptchaController {
|
||||
// 生成验证码
|
||||
CaptchaType captchaType = captchaProperties.getType();
|
||||
boolean isMath = CaptchaType.MATH == captchaType;
|
||||
//如果是则拿取数字验证码位数,如果不是则拿取字符验证码长度
|
||||
Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength();
|
||||
CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length);
|
||||
AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz());
|
||||
captcha.setGenerator(codeGenerator);
|
||||
captcha.createCode();
|
||||
// 如果是数学验证码,使用SpEL表达式处理验证码结果
|
||||
String code = captcha.getCode();
|
||||
if (isMath) {
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
|
||||
Reference in New Issue
Block a user