mirror of
https://github.com/zfile-dev/zfile.git
synced 2025-04-19 05:34:52 +00:00
♻️ 重构代码, 新增全局异常处理器, 优化类名
This commit is contained in:
@@ -38,27 +38,6 @@ public interface FileService {
|
||||
@Cacheable
|
||||
String getDownloadUrl(String path) throws Exception;
|
||||
|
||||
/**
|
||||
* 构建指定路径下标题, 页头, 页尾
|
||||
* @param path 路径
|
||||
*/
|
||||
@Cacheable
|
||||
default SiteConfig getConfig(String path) throws Exception {
|
||||
SiteConfig siteConfig = new SiteConfig();
|
||||
FileService fileService = (FileService) AopContext.currentProxy();
|
||||
|
||||
List<FileItem> fileItemList = fileService.fileList(path);
|
||||
path = StringUtils.removeLastSeparator(path);
|
||||
for (FileItem fileItem : fileItemList) {
|
||||
if (ZfileConstant.README_FILE_NAME.equalsIgnoreCase(fileItem.getName())) {
|
||||
siteConfig.setFooter(getTextContent(path + "/" + fileItem.getName()));
|
||||
} else if (ZfileConstant.HEADER_FILE_NAME.equalsIgnoreCase(fileItem.getName())) {
|
||||
siteConfig.setHeader(getTextContent(path + "/" + fileItem.getName()));
|
||||
}
|
||||
}
|
||||
return siteConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件内容.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user