From b00171366ff27099133675f8bd66464b5e037867 Mon Sep 17 00:00:00 2001 From: XTvLi <948038320@qq.com> Date: Wed, 10 Nov 2021 18:17:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=85=A8=E5=B1=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=86=85=E5=AE=B9,=20=E5=88=A0=E9=99=A4=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E8=B0=83=E7=94=A8=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/common/CaptchaController.java | 7 ++----- .../java/com/ruoyi/common/config/RuoYiConfig.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index 649fd115e..955c78436 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -6,8 +6,8 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.config.RuoYiConfig; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.util.FastByteArrayOutputStream; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -36,10 +36,6 @@ public class CaptchaController @Autowired private RedisCache redisCache; - // 验证码类型 - @Value("${ruoyi.captchaType}") - private String captchaType; - @Autowired private ISysConfigService configService; /** @@ -64,6 +60,7 @@ public class CaptchaController BufferedImage image = null; // 生成验证码 + String captchaType = RuoYiConfig.getCaptchaType(); if ("math".equals(captchaType)) { String capText = captchaProducerMath.createText(); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java index 843b91912..84c0029db 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java @@ -30,6 +30,9 @@ public class RuoYiConfig /** 获取地址开关 */ private static boolean addressEnabled; + /** 验证码类型 */ + private static String captchaType; + public String getName() { return name; @@ -90,6 +93,14 @@ public class RuoYiConfig RuoYiConfig.addressEnabled = addressEnabled; } + public static String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + RuoYiConfig.captchaType = captchaType; + } + /** * 获取导入上传路径 */