diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index baa1af9..65302d0 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -151,6 +151,13 @@ swagger:
# 请求前缀
pathMapping: /dev-api
+# 博客网站文章同步配置
+website-sync:
+ base-url: https://www.yidaima.cn/prod-api
+ api-key: 9628e0e5d85e541591a47a0e768fabddbf62c9d0fcc6c21da3a41ea65afd505c
+ connect-timeout: 5000
+ read-timeout: 30000
+
# 防止XSS攻击
xss:
# 过滤开关
diff --git a/ruoyi-office/src/main/java/com/ruoyi/office/controller/TtCodeController.java b/ruoyi-office/src/main/java/com/ruoyi/office/controller/TtCodeController.java
index 1480895..6b9821b 100644
--- a/ruoyi-office/src/main/java/com/ruoyi/office/controller/TtCodeController.java
+++ b/ruoyi-office/src/main/java/com/ruoyi/office/controller/TtCodeController.java
@@ -1,5 +1,6 @@
package com.ruoyi.office.controller;
+import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -19,6 +20,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.office.domain.TtCode;
import com.ruoyi.office.service.ITtCodeService;
+import com.ruoyi.office.service.IWebsiteArticleSyncService;
+import com.ruoyi.office.service.TtScreenshotArchiveService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -35,6 +38,12 @@ public class TtCodeController extends BaseController
@Autowired
private ITtCodeService ttCodeService;
+ @Autowired
+ private IWebsiteArticleSyncService websiteArticleSyncService;
+
+ @Autowired
+ private TtScreenshotArchiveService screenshotArchiveService;
+
/**
* 查询源码管理列表
*/
@@ -60,6 +69,17 @@ public class TtCodeController extends BaseController
util.exportExcel(response, list, "源码管理数据");
}
+ /**
+ * 下载所选源码项目在文件管理中关联的全部截图。
+ */
+ @PreAuthorize("@ss.hasPermi('office:code:export')")
+ @Log(title = "下载项目截图", businessType = BusinessType.EXPORT)
+ @GetMapping("/screenshots/{codeId}/download")
+ public void downloadScreenshots(@PathVariable Long codeId, HttpServletResponse response) throws IOException
+ {
+ screenshotArchiveService.download(codeId, response);
+ }
+
/**
* 获取源码管理详细信息
*/
@@ -113,4 +133,17 @@ public class TtCodeController extends BaseController
String msg = ttCodeService.transToArticle1(codeId, templateId);
return success(msg);
}
+
+ /**
+ * 将“复制网站文案”同步为网站Markdown文章。
+ */
+ @PreAuthorize("@ss.hasPermi('office:code:edit')")
+ @Log(title = "同步网站", businessType = BusinessType.UPDATE)
+ @PostMapping("/syncWebsite/{codeId}")
+ public AjaxResult syncWebsite(@PathVariable Long codeId) {
+ com.ruoyi.office.domain.WebsiteArticleSyncResult result =
+ websiteArticleSyncService.syncWebsite(codeId);
+ String message = result.isCreated() ? "同步网站成功,已创建文章" : "同步网站成功,已更新文章";
+ return AjaxResult.success(message, result);
+ }
}
diff --git a/ruoyi-office/src/main/java/com/ruoyi/office/service/impl/TtCodeServiceImpl.java b/ruoyi-office/src/main/java/com/ruoyi/office/service/impl/TtCodeServiceImpl.java
index 74f7b19..ae23a81 100644
--- a/ruoyi-office/src/main/java/com/ruoyi/office/service/impl/TtCodeServiceImpl.java
+++ b/ruoyi-office/src/main/java/com/ruoyi/office/service/impl/TtCodeServiceImpl.java
@@ -75,6 +75,9 @@ public class TtCodeServiceImpl implements ITtCodeService {
@Override
public TtCode selectTtCodeByCodeId(Long codeId) {
TtCode ttCode = ttCodeMapper.selectTtCodeByCodeId(codeId);
+ if (ttCode == null) {
+ return null;
+ }
TtFile file = new TtFile();
file.setCodeName(ttCode.getCodeName());
ttCode.setFileList(fileMapper.selectTtFileList(file));
diff --git a/ruoyi-office/src/main/resources/mapper/office/TtFileMapper.xml b/ruoyi-office/src/main/resources/mapper/office/TtFileMapper.xml
index 42b8806..ac30dd4 100644
--- a/ruoyi-office/src/main/resources/mapper/office/TtFileMapper.xml
+++ b/ruoyi-office/src/main/resources/mapper/office/TtFileMapper.xml
@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
diff --git a/ruoyi-ui/src/api/office/code.js b/ruoyi-ui/src/api/office/code.js
index 016d597..3d0dc52 100644
--- a/ruoyi-ui/src/api/office/code.js
+++ b/ruoyi-ui/src/api/office/code.js
@@ -52,3 +52,21 @@ export function transToArticle1(codeId, templateId) {
}
})
}
+
+// 将复制网站文案同步到博客网站
+export function syncWebsite(codeId) {
+ return request({
+ url: '/office/code/syncWebsite/' + codeId,
+ method: 'post'
+ })
+}
+
+// 下载项目在文件管理中关联的全部截图
+export function downloadScreenshots(codeId) {
+ return request({
+ url: '/office/code/screenshots/' + codeId + '/download',
+ method: 'get',
+ responseType: 'blob',
+ timeout: 120000
+ })
+}
diff --git a/ruoyi-ui/src/views/office/code/index.vue b/ruoyi-ui/src/views/office/code/index.vue
index 3a328a9..ddb40ca 100644
--- a/ruoyi-ui/src/views/office/code/index.vue
+++ b/ruoyi-ui/src/views/office/code/index.vue
@@ -96,6 +96,19 @@
>导出
+
+ 下载截图
+
+
@@ -121,7 +134,17 @@
icon="el-icon-document-copy"
@click="showCoverDialog(scope.row)"
v-hasPermi="['office:code:edit']"
- >转文章(南音)
+ >同步小程序
+
+ 同步网站