From ed3b77615ec6b1cce7a3e51516115238be61b4cf Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 31 Aug 2022 10:26:46 +0800 Subject: [PATCH] fix --- src/main/java/com/xcong/farmer/cms/configurations/properties/CmsProperties.java | 2 ++ src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/CmsTemplateServiceImpl.java | 7 ++++--- src/main/resources/application-prod.yml | 1 + src/main/resources/application-test.yml | 2 +- src/main/resources/application-xc.yml | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/xcong/farmer/cms/configurations/properties/CmsProperties.java b/src/main/java/com/xcong/farmer/cms/configurations/properties/CmsProperties.java index 440a51c..dcb892d 100644 --- a/src/main/java/com/xcong/farmer/cms/configurations/properties/CmsProperties.java +++ b/src/main/java/com/xcong/farmer/cms/configurations/properties/CmsProperties.java @@ -10,6 +10,8 @@ @ConfigurationProperties(prefix = "cms") public class CmsProperties { + private String downloadPath; + /** * 模板保存地址 */ diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/CmsTemplateServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/CmsTemplateServiceImpl.java index 71c2ee3..23e9100 100644 --- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/CmsTemplateServiceImpl.java +++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/CmsTemplateServiceImpl.java @@ -251,10 +251,11 @@ String templatePath = FileUtils.path(cmsProperties.getTemplatePath(), company.getCode()); String staticPath = FileUtils.path(cmsProperties.getStaticPath(), company.getCode()); + String downloadPath = FileUtils.path(cmsProperties.getDownloadPath(), company.getCode()); String fileName = "template.zip"; - ZipUtil.zip(FileUtil.file(staticPath + "/template.zip"), true, FileUtil.file(templatePath), FileUtil.file(staticPath)); - - return Result.ok("success", cmsProperties.getStaticUrl() + company.getCode() + "/" + fileName); + ZipUtil.zip(FileUtil.file(downloadPath + "/template.zip"), true, FileUtil.file(templatePath), FileUtil.file(staticPath)); + String url = cmsProperties.getStaticUrl() + "download/" + company.getCode(); + return Result.ok("success", url +"/" + fileName); } } diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 88e3f6c..ecad3e2 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -109,4 +109,5 @@ template-path: /home/javaweb/webresource/cms/template static-path: /home/javaweb/webresource/cms/static output-path: /home/javaweb/webresource/cms/output + download-path: /home/javaweb/webresource/cms/download diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index f3690cc..a730f59 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -109,4 +109,4 @@ template-path: /home/javaweb/webresource/cms/template static-path: /home/javaweb/webresource/cms/static output-path: /home/javaweb/webresource/cms/output - + download-path: /home/javaweb/webresource/cms/static/download diff --git a/src/main/resources/application-xc.yml b/src/main/resources/application-xc.yml index 9f17f3c..4c98b9f 100644 --- a/src/main/resources/application-xc.yml +++ b/src/main/resources/application-xc.yml @@ -109,4 +109,5 @@ template-path: /mnt/webresource/website/static/cms/template static-path: /mnt/webresource/website/static/cms/static output-path: /mnt/webresource/website/site + download-path: /mnt/webresource/website/static/cms/static/download -- Gitblit v1.9.1