feat: 支持创作入口公告配置

This commit is contained in:
2026-06-03 03:31:45 +08:00
parent 1cb11bc1dd
commit 70ff18ad90
52 changed files with 3045 additions and 504 deletions

View File

@@ -51,8 +51,9 @@ pub const DEFAULT_CREATION_ENTRY_START_IDLE_BADGE: &str = "模板 Tab";
pub const DEFAULT_CREATION_ENTRY_START_BUSY_BADGE: &str = "正在开启";
pub const DEFAULT_CREATION_ENTRY_MODAL_TITLE: &str = "选择创作类型";
pub const DEFAULT_CREATION_ENTRY_MODAL_DESCRIPTION: &str = "先选玩法类型,再进入对应创作工作台。";
pub const DEFAULT_CREATION_ENTRY_CATEGORY_ID: &str = "recent";
pub const DEFAULT_CREATION_ENTRY_CATEGORY_LABEL: &str = "最近创作";
/// 创作模板分类缺省回退到推荐,不再把真实作品维度的“最近创作”种成模板页签。
pub const DEFAULT_CREATION_ENTRY_CATEGORY_ID: &str = "recommended";
pub const DEFAULT_CREATION_ENTRY_CATEGORY_LABEL: &str = "热门推荐";
pub const DEFAULT_CREATION_ENTRY_EVENT_TITLE: &str = "主题创作赛";
pub const DEFAULT_CREATION_ENTRY_EVENT_DESCRIPTION: &str = "用温暖的色彩,捏出秋天的故事。";
pub const DEFAULT_CREATION_ENTRY_EVENT_COVER_IMAGE_SRC: &str =
@@ -60,6 +61,10 @@ pub const DEFAULT_CREATION_ENTRY_EVENT_COVER_IMAGE_SRC: &str =
pub const DEFAULT_CREATION_ENTRY_EVENT_PRIZE_POOL_MUD_POINTS: u64 = 58_000;
pub const DEFAULT_CREATION_ENTRY_EVENT_STARTS_AT_TEXT: &str = "2024.10.20 10:00";
pub const DEFAULT_CREATION_ENTRY_EVENT_ENDS_AT_TEXT: &str = "2024.11.20 23:59";
/// 后台创作入口公告最多允许配置的轮播条数。
pub const CREATION_ENTRY_EVENT_BANNERS_MAX_COUNT: usize = 8;
/// 单条 HTML 公告的代码大小上限,避免后台误贴超大片段拖慢入口页。
pub const CREATION_ENTRY_EVENT_BANNER_HTML_CODE_MAX_BYTES: usize = 12_000;
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
@@ -77,6 +82,7 @@ pub struct CreationEntryTypeModalSnapshot {
pub description: String,
}
/// 创作入口公告快照,支持 HTML 公告渲染和旧结构化 banner 兼容。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryEventBannerSnapshot {
@@ -86,6 +92,8 @@ pub struct CreationEntryEventBannerSnapshot {
pub prize_pool_mud_points: u64,
pub starts_at_text: String,
pub ends_at_text: String,
pub render_mode: String,
pub html_code: Option<String>,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
@@ -106,6 +114,7 @@ pub struct CreationEntryTypeSnapshot {
pub unified_creation_spec_json: Option<String>,
}
/// 创作入口全局配置快照,供前台入口页和后台配置页共同读取。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryConfigSnapshot {
@@ -113,6 +122,8 @@ pub struct CreationEntryConfigSnapshot {
pub start_card: CreationEntryStartCardSnapshot,
pub type_modal: CreationEntryTypeModalSnapshot,
pub event_banner: CreationEntryEventBannerSnapshot,
/// 底部加号创作入口页的多公告 JSON 配置;旧库为空时由应用层兜底。
pub event_banners_json: Option<String>,
pub creation_types: Vec<CreationEntryTypeSnapshot>,
pub updated_at_micros: i64,
}
@@ -134,6 +145,14 @@ pub struct CreationEntryTypeAdminUpsertInput {
pub unified_creation_spec_json: Option<String>,
}
/// 后台保存创作入口多公告表单序列化结果的领域输入。
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryEventBannersAdminUpsertInput {
/// 持久化字段沿用 JSON 字符串,内容由后台表单生成。
pub event_banners_json: String,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CreationEntryConfigProcedureResult {