From 651fa7b481a5688e8f0e88a6031b60194168436e Mon Sep 17 00:00:00 2001 From: Jinquan_Ou <Jinquan@gdut.com> Date: 星期日, 19 三月 2023 21:28:34 +0800 Subject: [PATCH] 修改下载接口 --- zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java | 6 ++++++ ruoyi-admin/src/main/resources/application-druid.yml | 4 ++-- ruoyi-admin/src/main/resources/application.yml | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 7fb6bb7..2a751e1 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -8,8 +8,8 @@ master: url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: ZhangApp123! -# password: 123456 +# password: ZhangApp123! + password: 123456 # 浠庡簱鏁版嵁婧� slave: # 浠庢暟鎹簮寮�鍏�/榛樿鍏抽棴 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 4bd355f..63adf91 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -70,8 +70,8 @@ # redis 閰嶇疆 redis: # 鍦板潃 - host: localhost -# host: 192.168.88.68 +# host: localhost + host: 192.168.88.68 # 绔彛锛岄粯璁や负6379 port: 6379 # 鏁版嵁搴撶储寮� diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java index af2b9e1..5d280dc 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/DownLoadFileServiceImpl.java @@ -2,6 +2,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.service.DownLoadFileService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; @@ -14,9 +15,14 @@ */ @Service public class DownLoadFileServiceImpl implements DownLoadFileService { + + @Value("${ruoyi.profile}") + private String basePath; + @Override public AjaxResult downLoadFile(String path, HttpServletResponse response) { + path=basePath+path.substring(8); File file = new File(path); byte[] buffer = new byte[1024]; BufferedInputStream bis = null; -- Gitblit v1.9.1