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

@@ -19,6 +19,17 @@ impl From<module_runtime::CreationEntryTypeAdminUpsertInput> for CreationEntryTy
}
}
/// 将业务层 banner JSON 保存输入转换为 SpacetimeDB 生成绑定类型。
impl From<module_runtime::CreationEntryEventBannersAdminUpsertInput>
for CreationEntryEventBannersAdminUpsertInput
{
fn from(input: module_runtime::CreationEntryEventBannersAdminUpsertInput) -> Self {
Self {
event_banners_json: input.event_banners_json,
}
}
}
impl From<module_runtime::AdminWorkVisibilityListInput> for AdminWorkVisibilityListInput {
fn from(input: module_runtime::AdminWorkVisibilityListInput) -> Self {
Self {
@@ -233,6 +244,7 @@ fn map_admin_work_visibility_snapshot(
}
}
/// 从本地订阅表行组装创作入口配置响应,兼容旧单条 banner 字段。
pub(crate) fn build_creation_entry_config_record_from_rows(
header: CreationEntryConfig,
mut creation_types: Vec<CreationEntryTypeConfig>,
@@ -278,7 +290,10 @@ pub(crate) fn build_creation_entry_config_record_from_rows(
header.event_ends_at_text,
module_runtime::DEFAULT_CREATION_ENTRY_EVENT_ENDS_AT_TEXT,
),
render_mode: "structured".to_string(),
html_code: None,
},
event_banners_json: header.event_banners_json,
creation_types: creation_types
.into_iter()
.map(|item| module_runtime::CreationEntryTypeSnapshot {
@@ -308,6 +323,7 @@ pub(crate) fn build_creation_entry_config_record_from_rows(
)
}
/// 将 SpacetimeDB procedure 快照映射为 module-runtime 领域快照。
fn map_creation_entry_config_snapshot(
snapshot: CreationEntryConfigSnapshot,
) -> module_runtime::CreationEntryConfigSnapshot {
@@ -330,7 +346,10 @@ fn map_creation_entry_config_snapshot(
prize_pool_mud_points: snapshot.event_banner.prize_pool_mud_points,
starts_at_text: snapshot.event_banner.starts_at_text,
ends_at_text: snapshot.event_banner.ends_at_text,
render_mode: snapshot.event_banner.render_mode,
html_code: snapshot.event_banner.html_code,
},
event_banners_json: snapshot.event_banners_json,
creation_types: snapshot
.creation_types
.into_iter()