feat: Manifest全局版本号(站点/页面/规则/脚本任一变则递增)

This commit is contained in:
mediabot-pt
2026-07-05 22:05:00 +08:00
parent 41dfd04203
commit 8a2f6144a7
7 changed files with 44 additions and 1 deletions

View File

@@ -37,6 +37,10 @@ public class FlywayConfig {
"rules_json LONGTEXT NOT NULL, deleted TINYINT NOT NULL DEFAULT 0, " +
"created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
"INDEX idx_site_type (site_type, deleted)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
stmt.execute("CREATE TABLE IF NOT EXISTS manifest_version (" +
"id INT PRIMARY KEY DEFAULT 1, version INT NOT NULL DEFAULT 1, updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP," +
"CHECK (id = 1)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
stmt.execute("INSERT IGNORE INTO manifest_version (id, version) VALUES (1, 1)");
log.info("V15 tables initialized");
} catch (Exception e) {
log.error("V15 migration failed: {}", e.getMessage());

View File

@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class ManifestController {
private final com.par.core.service.ManifestVersionService versionService;
private final SiteMapper siteMapper;
private final SiteConfigMapper siteConfigMapper;
private final com.par.core.mapper.SitePagesMapper sitePagesMapper;
@@ -88,7 +89,7 @@ public class ManifestController {
}
Map<String, Object> manifest = new HashMap<>();
manifest.put("version", "1.0");
manifest.put("version", versionService.current());
manifest.put("sites", entries);
return ResponseEntity.ok().eTag(etag).body(ApiResponse.success(manifest));