fix-page-config-reload-empty

This commit is contained in:
mediabot-pt
2026-07-06 12:14:38 +08:00
parent 9207039046
commit 7042149a13
2 changed files with 9 additions and 4 deletions

View File

@@ -29,12 +29,15 @@ public class SitePagesServiceImpl implements SitePagesService {
.orderByDesc(SitePages::getId).last("limit 1"));
if (sp == null) return null;
try {
List<Map<String, Object>> entries = om.readValue(sp.getEntriesJson(),
new TypeReference<List<Map<String, Object>>>() {});
// entriesJson 存储的是完整 JSON: { entries: [...], authType: "...", authValue: "..." }
Map<String, Object> parsed = om.readValue(sp.getEntriesJson(),
new TypeReference<Map<String, Object>>() {});
Map<String, Object> result = new LinkedHashMap<>();
result.put("siteId", siteId);
result.put("version", sp.getVersion());
result.put("entries", entries);
result.put("entries", parsed.getOrDefault("entries", List.of()));
if (parsed.containsKey("authType")) result.put("authType", parsed.get("authType"));
if (parsed.containsKey("authValue")) result.put("authValue", parsed.get("authValue"));
result.put("updatedAt", sp.getUpdatedAt());
return result;
} catch (Exception e) {
@@ -126,6 +129,7 @@ public class SitePagesServiceImpl implements SitePagesService {
m.put("siteId", sp.getSiteId());
m.put("version", sp.getVersion());
m.put("updatedAt", sp.getUpdatedAt());
m.put("entriesJson", sp.getEntriesJson());
result.add(m);
}
return result;