Quellcode durchsuchen

fix 修改二维码查询解析问题

tjf vor 3 Jahren
Ursprung
Commit
f74378ba4a

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java

@@ -76,7 +76,7 @@ public class CommonController
             // 上传并返回新文件名称
             String fileName = FileUploadUtils.upload(filePath, file);
             String originalFilename = file.getOriginalFilename();
-            String url = serverConfig.getUrl() + fileName;
+            String url = RuoYiConfig.getStaticIp() + fileName;
             AjaxResult ajax = AjaxResult.success();
             ajax.put("fileName", fileName);
             ajax.put("originalFilename", originalFilename);

+ 6 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/QueryController.java

@@ -182,7 +182,7 @@ public class QueryController extends BaseController {
     }
 
     /**
-     * 门户上传请求
+     * 门户二维码上传请求
      */
     @PostMapping("/common/upload")
     public AjaxResult uploadFile(MultipartFile file) throws Exception
@@ -190,13 +190,16 @@ public class QueryController extends BaseController {
         try
         {
             // 上传文件路径
-            String filePath = RuoYiConfig.getUploadPath();
+            String filePath = RuoYiConfig.getUploadQrPath();
             // 上传并返回新文件名称
             String fileName = FileUploadUtils.upload(filePath, file);
             String originalFilename = file.getOriginalFilename();
-            String url = serverConfig.getUrl() + fileName;
+            String url = RuoYiConfig.getStaticIp() + fileName;
+            String profile = RuoYiConfig.getUploadQrPath();
+            String absolutePath = fileName.replace("/profile/qrUpload",profile);
             AjaxResult ajax = AjaxResult.success();
             ajax.put("fileName", fileName);
+            ajax.put("absolutePath", absolutePath);
             ajax.put("originalFilename", originalFilename);
             ajax.put("url", url);
             return ajax;

+ 2 - 0
ruoyi-admin/src/main/resources/application-druid.yml

@@ -109,6 +109,8 @@ ruoyi:
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证
   captchaType: math
+  #线上地址
+  staticIp: http://192.168.101.11:8090
 
 # 开发环境配置
 server:

+ 2 - 0
ruoyi-admin/src/main/resources/application-prod.yml

@@ -128,6 +128,8 @@ ruoyi:
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证
   captchaType: math
+  #线上地址
+  staticIp: http://118.31.23.65:4000
 
 # 日志配置
 logging:

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: prod
+    active: druid

+ 53 - 44
ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java

@@ -5,91 +5,97 @@ import org.springframework.stereotype.Component;
 
 /**
  * 读取项目相关配置
- * 
+ *
  * @author ruoyi
  */
 @Component
 @ConfigurationProperties(prefix = "ruoyi")
-public class RuoYiConfig
-{
-    /** 项目名称 */
+public class RuoYiConfig {
+    /**
+     * 项目名称
+     */
     private String name;
 
-    /** 版本 */
+    /**
+     * 版本
+     */
     private String version;
 
-    /** 版权年份 */
+    /**
+     * 版权年份
+     */
     private String copyrightYear;
 
-    /** 实例演示开关 */
+    /**
+     * 实例演示开关
+     */
     private boolean demoEnabled;
 
-    /** 上传路径 */
+    /**
+     * 上传路径
+     */
     private static String profile;
 
-    /** 获取地址开关 */
+    /**
+     * 获取地址开关
+     */
     private static boolean addressEnabled;
 
-    /** 验证码类型 */
+    /**
+     * 验证码类型
+     */
     private static String captchaType;
 
-    public String getName()
-    {
+    /**
+     * 服务器地址
+     */
+    private static String staticIp;
+
+    public String getName() {
         return name;
     }
 
-    public void setName(String name)
-    {
+    public void setName(String name) {
         this.name = name;
     }
 
-    public String getVersion()
-    {
+    public String getVersion() {
         return version;
     }
 
-    public void setVersion(String version)
-    {
+    public void setVersion(String version) {
         this.version = version;
     }
 
-    public String getCopyrightYear()
-    {
+    public String getCopyrightYear() {
         return copyrightYear;
     }
 
-    public void setCopyrightYear(String copyrightYear)
-    {
+    public void setCopyrightYear(String copyrightYear) {
         this.copyrightYear = copyrightYear;
     }
 
-    public boolean isDemoEnabled()
-    {
+    public boolean isDemoEnabled() {
         return demoEnabled;
     }
 
-    public void setDemoEnabled(boolean demoEnabled)
-    {
+    public void setDemoEnabled(boolean demoEnabled) {
         this.demoEnabled = demoEnabled;
     }
 
-    public static String getProfile()
-    {
+    public static String getProfile() {
         return profile;
     }
 
-    public void setProfile(String profile)
-    {
+    public void setProfile(String profile) {
         RuoYiConfig.profile = profile;
     }
 
-    public static boolean isAddressEnabled()
-    {
+    public static boolean isAddressEnabled() {
         return addressEnabled;
     }
 
-    public void setAddressEnabled(boolean addressEnabled)
-    {
+    public void setAddressEnabled(boolean addressEnabled) {
         RuoYiConfig.addressEnabled = addressEnabled;
     }
 
@@ -101,43 +107,46 @@ public class RuoYiConfig
         RuoYiConfig.captchaType = captchaType;
     }
 
+    public static String getStaticIp() {
+        return staticIp;
+    }
+
+    public void setStaticIp(String staticIp) {
+        RuoYiConfig.staticIp = staticIp;
+    }
+
     /**
      * 获取导入上传路径
      */
-    public static String getImportPath()
-    {
+    public static String getImportPath() {
         return getProfile() + "/import";
     }
 
     /**
      * 获取头像上传路径
      */
-    public static String getAvatarPath()
-    {
+    public static String getAvatarPath() {
         return getProfile() + "/avatar";
     }
 
     /**
      * 获取下载路径
      */
-    public static String getDownloadPath()
-    {
+    public static String getDownloadPath() {
         return getProfile() + "/download/";
     }
 
     /**
      * 获取上传路径
      */
-    public static String getUploadPath()
-    {
+    public static String getUploadPath() {
         return getProfile() + "/upload";
     }
 
     /**
      * 获取系统生成二维码保存路径
      */
-    public static String getUploadQrPath()
-    {
+    public static String getUploadQrPath() {
         return getProfile() + "/qrUpload";
     }
 }