From 0e1f2682658a27df0f2c497a5daaf3a1af6f734b Mon Sep 17 00:00:00 2001 From: changpengfei Date: Wed, 29 Sep 2021 20:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lyms/talkonlineweb/controller/ArticleController.java | 2 +- talkonlineweb/src/main/resources/application-dev.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java index 89507c8..5dcdb7b 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java @@ -84,7 +84,7 @@ public class ArticleController { */ @GetMapping("showPic/{fileName}") public void showPic(@PathVariable("fileName") String fileName, HttpServletResponse response) { - try(InputStream in=new FileInputStream(new File(fileName)); + try(InputStream in=new FileInputStream(new File(uploadPath + File.separator +fileName)); OutputStream out=response.getOutputStream(); ){ IOUtils.copy(in,out); diff --git a/talkonlineweb/src/main/resources/application-dev.yml b/talkonlineweb/src/main/resources/application-dev.yml index 747de60..af9ff72 100644 --- a/talkonlineweb/src/main/resources/application-dev.yml +++ b/talkonlineweb/src/main/resources/application-dev.yml @@ -7,7 +7,9 @@ spring: username: platform password: Platform@123 uploadPath: /data/talkonline/upload/ -imgUrlPre: https://dev-talk-api.healthbaby.com.cn/showPic/ +#uploadPath: D:/test/upload/ +imgUrlPre: https://dev-talk-api.healthbaby.com.cn/art/showPic/ +#imgUrlPre: http://192.168.2.26:9090/art/showPic/ #环信配置 -- 1.8.3.1