fix: preview模式改为draft优先fallback到published(正式版+预览版并集)

This commit is contained in:
mediabot-pt
2026-07-07 11:38:52 +08:00
parent 5f58083074
commit e15e242153
3 changed files with 20 additions and 2 deletions

View File

@@ -54,6 +54,14 @@ public interface SiteSnapshotService {
*/
String getDraftBundleJson(String siteId);
/**
* 获取预览版快照 JSON(draft 优先,无 draft 时 fallback 到 published)
* 即:正式版 + 预览版 的并集
* @param siteId 站点标识
* @return JSON 字符串,空串表示无任何快照
*/
String getPreviewBundleJson(String siteId);
/**
* 按 checksum 判断是否需要更新
*/

View File

@@ -295,6 +295,16 @@ public class SiteSnapshotServiceImpl implements SiteSnapshotService {
});
}
@Override
public String getPreviewBundleJson(String siteId) {
// 先查 draft,有则返回;无则 fallback 到 published
String draftJson = getDraftBundleJson(siteId);
if (draftJson != null && !draftJson.isEmpty()) {
return draftJson;
}
return getActiveBundleJson(siteId);
}
@Override
public boolean isChanged(String siteId, String checksum) {
if (checksum == null) return true;