From 2b270e153c394ba9683e90785c6850a601378614 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期一, 05 一月 2026 17:53:34 +0800
Subject: [PATCH] 新增字段

---
 admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
index c389e41..d4ac2ba 100644
--- a/admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ b/admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -13,6 +13,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -42,6 +43,9 @@
     private ServerConfig serverConfig;
 
     private static final String FILE_DELIMETER = ",";
+
+    @Value("${custom.upload.network-path}")
+    private String networkPath;
 
     @Autowired
     private RedisCache redisCache;
@@ -111,7 +115,7 @@
             String filePath = RuoYiConfig.getUploadPath();
             // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
             String fileName = FileUploadUtils.upload(filePath, file);
-            String url = serverConfig.getUrl() + fileName;
+            String url = networkPath + fileName;
             AjaxResult ajax = AjaxResult.success();
             ajax.put("url", url);
             ajax.put("fileName", fileName);
@@ -133,12 +137,12 @@
             String filePath = RuoYiConfig.getUploadPath();
             // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
             String fileName = FileUploadUtils.upload(filePath, file);
-            String url = serverConfig.getUrl() + fileName;
+            String url = networkPath + fileName;
             HashMap<String, Object> stringObjectHashMap = new HashMap<>();
             stringObjectHashMap.put("url", url);
-            stringObjectHashMap.put("fileName", fileName);
-            stringObjectHashMap.put("newFileName", FileUtils.getName(fileName));
-            stringObjectHashMap.put("originalFilename", file.getOriginalFilename());
+            stringObjectHashMap.put("name", FileUtils.getName(fileName));
+//            stringObjectHashMap.put("newFileName", FileUtils.getName(fileName));
+//            stringObjectHashMap.put("originalFilename", file.getOriginalFilename());
             AjaxResult ajax = AjaxResult.success(stringObjectHashMap);
 
             return ajax;
@@ -167,7 +171,7 @@
             {
                 // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
                 String fileName = FileUploadUtils.upload(filePath, file);
-                String url = serverConfig.getUrl() + fileName;
+                String url = networkPath + fileName;
                 urls.add(url);
                 fileNames.add(fileName);
                 newFileNames.add(FileUtils.getName(fileName));

--
Gitblit v1.8.0