作者 若依
提交者 Gitee

!368 【轻量级 PR】: 统一全局配置文件

Merge pull request !368 from XTvLi/master
@@ -6,8 +6,8 @@ import java.util.concurrent.TimeUnit; @@ -6,8 +6,8 @@ import java.util.concurrent.TimeUnit;
6 import javax.annotation.Resource; 6 import javax.annotation.Resource;
7 import javax.imageio.ImageIO; 7 import javax.imageio.ImageIO;
8 import javax.servlet.http.HttpServletResponse; 8 import javax.servlet.http.HttpServletResponse;
  9 +import com.ruoyi.common.config.RuoYiConfig;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 -import org.springframework.beans.factory.annotation.Value;  
11 import org.springframework.util.FastByteArrayOutputStream; 11 import org.springframework.util.FastByteArrayOutputStream;
12 import org.springframework.web.bind.annotation.GetMapping; 12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.RestController; 13 import org.springframework.web.bind.annotation.RestController;
@@ -36,10 +36,6 @@ public class CaptchaController @@ -36,10 +36,6 @@ public class CaptchaController
36 @Autowired 36 @Autowired
37 private RedisCache redisCache; 37 private RedisCache redisCache;
38 38
39 - // 验证码类型  
40 - @Value("${ruoyi.captchaType}")  
41 - private String captchaType;  
42 -  
43 @Autowired 39 @Autowired
44 private ISysConfigService configService; 40 private ISysConfigService configService;
45 /** 41 /**
@@ -64,6 +60,7 @@ public class CaptchaController @@ -64,6 +60,7 @@ public class CaptchaController
64 BufferedImage image = null; 60 BufferedImage image = null;
65 61
66 // 生成验证码 62 // 生成验证码
  63 + String captchaType = RuoYiConfig.getCaptchaType();
67 if ("math".equals(captchaType)) 64 if ("math".equals(captchaType))
68 { 65 {
69 String capText = captchaProducerMath.createText(); 66 String capText = captchaProducerMath.createText();
@@ -30,6 +30,9 @@ public class RuoYiConfig @@ -30,6 +30,9 @@ public class RuoYiConfig
30 /** 获取地址开关 */ 30 /** 获取地址开关 */
31 private static boolean addressEnabled; 31 private static boolean addressEnabled;
32 32
  33 + /** 验证码类型 */
  34 + private static String captchaType;
  35 +
33 public String getName() 36 public String getName()
34 { 37 {
35 return name; 38 return name;
@@ -90,6 +93,14 @@ public class RuoYiConfig @@ -90,6 +93,14 @@ public class RuoYiConfig
90 RuoYiConfig.addressEnabled = addressEnabled; 93 RuoYiConfig.addressEnabled = addressEnabled;
91 } 94 }
92 95
  96 + public static String getCaptchaType() {
  97 + return captchaType;
  98 + }
  99 +
  100 + public void setCaptchaType(String captchaType) {
  101 + RuoYiConfig.captchaType = captchaType;
  102 + }
  103 +
93 /** 104 /**
94 * 获取导入上传路径 105 * 获取导入上传路径
95 */ 106 */