From 6567dfe6286a601c3fe4111d2d866398784373a7 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 07 八月 2023 18:38:41 +0800
Subject: [PATCH] 获取端口号
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java | 8 +++++++-
1 files changed, 7 insertions(+), 1 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 36480c8..c4ac6c3 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
@@ -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;
@@ -73,7 +74,12 @@
String filePath = RuoYiConfig.getUploadPath();
// 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
String fileName = FileUploadUtils.upload(filePath, file);
- String url = serverConfig.getUrl() + fileName;
+
+ //鍥犱负serverConfig.getUrl()鎷垮埌鐨勭鍙e彿锛屼笉鏄痶omcat鐨勭鍙e彿锛岃繖閲岄渶瑕佽浆涓�涓�
+ String url1 = serverConfig.getUrl();
+ url1 = url1.substring(0, url1.lastIndexOf(":")) + ":" + tomcatPort;
+ log.info("url1鐨勫��:{} ,port鐨勫��:{}", url1, tomcatPort);
+ String url = url1 + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
--
Gitblit v1.9.3