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

@@ -34,7 +34,7 @@ public class SnapshotController {
* 获取站点当前生效配置快照(供 mediabot 使用)
* 支持 ETag (If-None-Match) 实现增量更新
* 优先从 Caffeine 缓存读取,缓存未命中查数据库并回退七牛云 CDN
* @param preview true=读取最新 draft(预览版),false/不传=读取最新 published(正式版)
* @param preview false/不传=仅正式版(published),true=预览版优先(draft → published fallback)
*/
@GetMapping("/{siteId}")
public ResponseEntity<?> getSnapshot(
@@ -44,7 +44,7 @@ public class SnapshotController {
try {
String bundleJson = preview
? snapshotService.getDraftBundleJson(siteId)
? snapshotService.getPreviewBundleJson(siteId)
: snapshotService.getActiveBundleJson(siteId);
if (bundleJson == null || bundleJson.isEmpty()) {