fix: 修复快照两阶段发布方案的缓存一致性和前端问题
1. updateSnapshot() 自动触发生成 draft 后刷新 draft/preview 缓存 2. saveDraft() 同时刷新 previewJsonCache 3. 前端编辑页新增「保存站点」按钮,确保站点基本信息可持久化 4. publishManifest() 兼容 bundle 改用缓存 JSON,避免重复 buildSnapshot
This commit is contained in:
@@ -156,6 +156,12 @@ public class SiteSnapshotServiceImpl implements SiteSnapshotService {
|
||||
snapshot.setStatus("draft");
|
||||
|
||||
snapshotMapper.insert(snapshot);
|
||||
|
||||
// 刷新 draft 和 preview 缓存(审批通过后异步生成 draft,需立即可被预览查询到)
|
||||
String bundleJson = toBundleJson(snapshot);
|
||||
draftJsonCache.put(siteId, bundleJson);
|
||||
previewJsonCache.put(siteId, bundleJson);
|
||||
|
||||
log.info("快照已更新: siteId={}, version={}, checksum={}", siteId, newVersion, checksum.substring(0, 8));
|
||||
return snapshot;
|
||||
} catch (Exception e) {
|
||||
@@ -195,9 +201,10 @@ public class SiteSnapshotServiceImpl implements SiteSnapshotService {
|
||||
|
||||
snapshotMapper.insert(snapshot);
|
||||
|
||||
// 刷新 draft 缓存
|
||||
// 刷新 draft 和 preview 缓存
|
||||
String bundleJson = toBundleJson(snapshot);
|
||||
draftJsonCache.put(siteId, bundleJson);
|
||||
previewJsonCache.put(siteId, bundleJson);
|
||||
|
||||
log.info("草稿已保存: siteId={}, version={}, checksum={}", siteId, newVersion, checksum.substring(0, 8));
|
||||
return snapshot;
|
||||
|
||||
Reference in New Issue
Block a user