From c111e3eff1191b29d2d2baf2f485a4bf3a2edc00 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期六, 16 八月 2025 14:34:07 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
index 8ad8488..6e219b2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -59,6 +59,12 @@
     @Value("${uploadSwitch}")
     private Integer uploadSwitch;
 
+    @Value("${req_path}")
+    private String reqPath;
+
+    @Value("${localIP}")
+    private String localIP;
+
     /**
      * 閫氱敤涓嬭浇璇锋眰
      *
@@ -108,7 +114,10 @@
             String fileName = FileUploadUtils.uploadSort(filePath, file);
             String url = null;
             //鏂板崕鍖婚櫌鐗规畩锛岃繖涓棰戠殑璁块棶寰楄浆
-            String xhPath = "http://218.108.11.22:8093/profile-api";
+            String xhPath = localIP + ":" + reqPath + "/profile-api";
+            if (localIP.contains("127.0.0.1") || localIP.contains("localhost")) {
+                xhPath = localIP + ":8095" + "/profile";
+            }
             if (uploadSwitch == 1) {
                 String fn = fileName.replaceAll("/profile", "");
                 url = xhPath + fn;
@@ -143,7 +152,10 @@
             convertDocToHtml(filePath + "\\" + file.getOriginalFilename(), filePath + "\\" + file.getOriginalFilename().split("\\.", 2)[0] + ".html");
 
             String url = null;
-            String xhPath = "http://218.108.11.22:8093/profile-api";
+            String xhPath = localIP + ":" + reqPath + "/profile-api";
+            if (localIP.contains("127.0.0.1") || localIP.contains("localhost")) {
+                xhPath = localIP + ":8095" + "/profile";
+            }
             if (uploadSwitch == 1) {
                 String fn = fileName.replaceAll("\\.[^.]*$", ".html").replaceAll("/profile", "");
                 url = xhPath + fn;
@@ -269,7 +281,10 @@
             e.printStackTrace();
         }
         String url = null;
-        String xhPath = "http://218.108.11.22:8093/profile-api";
+        String xhPath = localIP + ":" + reqPath + "/profile-api";
+        if (localIP.contains("127.0.0.1") || localIP.contains("localhost")) {
+            xhPath = localIP + ":8095" + "/profile";
+        }
         if (uploadSwitch == 1) {
             url = xhPath + "/upload/show/" + fileName.split("\\.", 2)[0] + "/" + fileName;
         } else {
@@ -313,6 +328,5 @@
         System.out.println("word杞琱tml鎴愬姛");
 
     }
-
 
 }

--
Gitblit v1.9.3