From a09994c76b3400a5ac97f38b61dbefae817a13fb Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Sun, 28 Sep 2025 16:50:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E9=99=84=E4=BB=B6=E5=9C=B0=E5=9D=80=E5=8F=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=8A=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/core/client/db/DBFileClient.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/agt-module-infra/agt-module-infra-server/src/main/java/org/agt/module/infra/framework/file/core/client/db/DBFileClient.java b/agt-module-infra/agt-module-infra-server/src/main/java/org/agt/module/infra/framework/file/core/client/db/DBFileClient.java index fa31360..f93eb90 100644 --- a/agt-module-infra/agt-module-infra-server/src/main/java/org/agt/module/infra/framework/file/core/client/db/DBFileClient.java +++ b/agt-module-infra/agt-module-infra-server/src/main/java/org/agt/module/infra/framework/file/core/client/db/DBFileClient.java @@ -1,6 +1,7 @@ package org.agt.module.infra.framework.file.core.client.db; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import org.agt.module.infra.dal.dataobject.file.FileContentDO; import org.agt.module.infra.dal.mysql.file.FileContentMapper; @@ -18,6 +19,13 @@ public class DBFileClient extends AbstractFileClient { private FileContentMapper fileContentMapper; + /** + * 邮件的开关,默认为 true + */ + private String domain; + + private String port; + public DBFileClient(Long id, DBFileClientConfig config) { super(id, config); } @@ -25,6 +33,8 @@ public class DBFileClient extends AbstractFileClient { @Override protected void doInit() { fileContentMapper = SpringUtil.getBean(FileContentMapper.class); + domain = SpringUtil.getProperty("agt.domain", "http://localhost"); + port = SpringUtil.getProperty("server.port", "48080"); } @Override @@ -33,7 +43,11 @@ public class DBFileClient extends AbstractFileClient { .setPath(path).setContent(content); fileContentMapper.insert(contentDO); // 拼接返回路径 - return super.formatFileUrl(config.getDomain(), path); + String fileDomain = config.getDomain(); + if (StrUtil.isBlank(fileDomain)) { + fileDomain = domain + ":" + port; + } + return super.formatFileUrl(fileDomain, path); } @Override