| | |
| | | |
| | | for (File templateFile : files) { |
| | | if (!templateFile.isFile()) { |
| | | FileUtil.move(templateFile, new File(FileUtils.path(staticPath, templateFile.getName())), true); |
| | | FileUtil.move(templateFile, new File(staticPath), true); |
| | | continue; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public Result viewTemplateInfo(Long id) { |
| | | Result result = new Result(); |
| | | CmsTemplateEntity cmsTemplateEntity = this.baseMapper.selectById(id); |
| | | String templatePath = cmsProperties.getTemplatePath(); |
| | | String pathName = FileUtils.path(templatePath, cmsTemplateEntity.getPath()); |
| | |
| | | bytes = Files.readAllBytes(Paths.get(pathName)); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | return Result.ok("未找到模板"); |
| | | return result.fail("未找到模板"); |
| | | } |
| | | |
| | | String content = new String(bytes, StandardCharsets.UTF_8); |
| | | return Result.ok(content ); |
| | | result.setData(content); |
| | | return result; |
| | | } |
| | | |
| | | } |