This commit is contained in:
@@ -4,6 +4,10 @@ const ASSET_HISTORY_MAX_LIMIT: usize = 120;
|
||||
const ASSET_HISTORY_CHARACTER_VISUAL_KIND: &str = "character_visual";
|
||||
const ASSET_HISTORY_SCENE_IMAGE_KIND: &str = "scene_image";
|
||||
const ASSET_HISTORY_PUZZLE_COVER_IMAGE_KIND: &str = "puzzle_cover_image";
|
||||
const ASSET_HISTORY_SQUARE_HOLE_COVER_IMAGE_KIND: &str = "square_hole_cover_image";
|
||||
const ASSET_HISTORY_SQUARE_HOLE_BACKGROUND_IMAGE_KIND: &str = "square_hole_background_image";
|
||||
const ASSET_HISTORY_SQUARE_HOLE_SHAPE_IMAGE_KIND: &str = "square_hole_shape_image";
|
||||
const ASSET_HISTORY_SQUARE_HOLE_HOLE_IMAGE_KIND: &str = "square_hole_hole_image";
|
||||
|
||||
/// 资产事件类型。
|
||||
///
|
||||
@@ -204,9 +208,13 @@ fn list_asset_history(
|
||||
if asset_kind != ASSET_HISTORY_CHARACTER_VISUAL_KIND
|
||||
&& asset_kind != ASSET_HISTORY_SCENE_IMAGE_KIND
|
||||
&& asset_kind != ASSET_HISTORY_PUZZLE_COVER_IMAGE_KIND
|
||||
&& asset_kind != ASSET_HISTORY_SQUARE_HOLE_COVER_IMAGE_KIND
|
||||
&& asset_kind != ASSET_HISTORY_SQUARE_HOLE_BACKGROUND_IMAGE_KIND
|
||||
&& asset_kind != ASSET_HISTORY_SQUARE_HOLE_SHAPE_IMAGE_KIND
|
||||
&& asset_kind != ASSET_HISTORY_SQUARE_HOLE_HOLE_IMAGE_KIND
|
||||
{
|
||||
return Err(
|
||||
"历史素材类型只支持 character_visual、scene_image 或 puzzle_cover_image".to_string(),
|
||||
"历史素材类型只支持 character_visual、scene_image、puzzle_cover_image、square_hole_cover_image、square_hole_background_image、square_hole_shape_image 或 square_hole_hole_image".to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -471,7 +471,6 @@ pub fn list_profile_wallet_ledger(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// analytics metric 查询直接聚合 tracking_daily_stat,避免 API 层订阅全量表后自行汇总。
|
||||
#[spacetimedb::procedure]
|
||||
pub fn query_analytics_metric(
|
||||
@@ -2747,7 +2746,6 @@ fn build_profile_task_center_snapshot(
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fn query_analytics_metric_buckets(
|
||||
ctx: &ReducerContext,
|
||||
input: AnalyticsMetricQueryInput,
|
||||
|
||||
@@ -1116,12 +1116,15 @@ fn normalize_config(
|
||||
config.cover_image_src = config.cover_image_src.trim().to_string();
|
||||
config.background_image_src = config.background_image_src.trim().to_string();
|
||||
|
||||
let hole_options = normalize_domain_hole_options(
|
||||
domain_hole_options_from_snapshot(&config.hole_options),
|
||||
&config.theme_text,
|
||||
);
|
||||
let shape_options = normalize_domain_shape_options(
|
||||
domain_shape_options_from_snapshot(&config.shape_options),
|
||||
&config.theme_text,
|
||||
hole_options.as_slice(),
|
||||
);
|
||||
let hole_options =
|
||||
normalize_domain_hole_options(domain_hole_options_from_snapshot(&config.hole_options));
|
||||
config.shape_options = shape_options_to_snapshot(&shape_options);
|
||||
config.hole_options = hole_options_to_snapshot(&hole_options);
|
||||
config
|
||||
@@ -1249,6 +1252,7 @@ fn shape_from_domain(shape: &DomainSquareHoleShapeSnapshot) -> SquareHoleShapeSn
|
||||
shape_id: shape.shape_id.clone(),
|
||||
shape_kind: shape.shape_kind.clone(),
|
||||
label: shape.label.clone(),
|
||||
target_hole_id: shape.target_hole_id.clone(),
|
||||
color: shape.color.clone(),
|
||||
image_src: shape.image_src.clone().unwrap_or_default(),
|
||||
}
|
||||
@@ -1259,6 +1263,7 @@ fn domain_shape_from_snapshot(shape: &SquareHoleShapeSnapshot) -> DomainSquareHo
|
||||
shape_id: shape.shape_id.clone(),
|
||||
shape_kind: shape.shape_kind.clone(),
|
||||
label: shape.label.clone(),
|
||||
target_hole_id: shape.target_hole_id.clone(),
|
||||
color: shape.color.clone(),
|
||||
image_src: empty_to_none(&shape.image_src),
|
||||
}
|
||||
@@ -1271,7 +1276,7 @@ fn hole_from_domain(hole: &DomainSquareHoleHoleSnapshot) -> SquareHoleHoleSnapsh
|
||||
label: hole.label.clone(),
|
||||
x: hole.x,
|
||||
y: hole.y,
|
||||
bonus: hole.bonus,
|
||||
image_src: hole.image_src.clone().unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1282,7 +1287,7 @@ fn domain_hole_from_snapshot(hole: &SquareHoleHoleSnapshot) -> DomainSquareHoleH
|
||||
label: hole.label.clone(),
|
||||
x: hole.x,
|
||||
y: hole.y,
|
||||
bonus: hole.bonus,
|
||||
image_src: empty_to_none(&hole.image_src),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1295,6 +1300,7 @@ fn shape_options_to_snapshot(
|
||||
option_id: option.option_id.clone(),
|
||||
shape_kind: option.shape_kind.clone(),
|
||||
label: option.label.clone(),
|
||||
target_hole_id: option.target_hole_id.clone(),
|
||||
image_prompt: option.image_prompt.clone(),
|
||||
image_src: option.image_src.clone().unwrap_or_default(),
|
||||
})
|
||||
@@ -1310,6 +1316,7 @@ fn domain_shape_options_from_snapshot(
|
||||
option_id: option.option_id.clone(),
|
||||
shape_kind: option.shape_kind.clone(),
|
||||
label: option.label.clone(),
|
||||
target_hole_id: option.target_hole_id.clone(),
|
||||
image_prompt: option.image_prompt.clone(),
|
||||
image_src: empty_to_none(&option.image_src),
|
||||
})
|
||||
@@ -1325,7 +1332,8 @@ fn hole_options_to_snapshot(
|
||||
hole_id: option.hole_id.clone(),
|
||||
hole_kind: option.hole_kind.clone(),
|
||||
label: option.label.clone(),
|
||||
bonus: option.bonus,
|
||||
image_prompt: option.image_prompt.clone(),
|
||||
image_src: option.image_src.clone().unwrap_or_default(),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -1339,7 +1347,8 @@ fn domain_hole_options_from_snapshot(
|
||||
hole_id: option.hole_id.clone(),
|
||||
hole_kind: option.hole_kind.clone(),
|
||||
label: option.label.clone(),
|
||||
bonus: option.bonus,
|
||||
image_prompt: option.image_prompt.clone(),
|
||||
image_src: empty_to_none(&option.image_src),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -228,6 +228,8 @@ pub struct SquareHoleShapeOptionSnapshot {
|
||||
pub option_id: String,
|
||||
pub shape_kind: String,
|
||||
pub label: String,
|
||||
#[serde(default)]
|
||||
pub target_hole_id: String,
|
||||
pub image_prompt: String,
|
||||
#[serde(default)]
|
||||
pub image_src: String,
|
||||
@@ -240,7 +242,9 @@ pub struct SquareHoleHoleOptionSnapshot {
|
||||
pub hole_kind: String,
|
||||
pub label: String,
|
||||
#[serde(default)]
|
||||
pub bonus: bool,
|
||||
pub image_prompt: String,
|
||||
#[serde(default)]
|
||||
pub image_src: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@@ -333,6 +337,8 @@ pub struct SquareHoleShapeSnapshot {
|
||||
pub shape_id: String,
|
||||
pub shape_kind: String,
|
||||
pub label: String,
|
||||
#[serde(default)]
|
||||
pub target_hole_id: String,
|
||||
pub color: String,
|
||||
#[serde(default)]
|
||||
pub image_src: String,
|
||||
@@ -347,7 +353,7 @@ pub struct SquareHoleHoleSnapshot {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
#[serde(default)]
|
||||
pub bonus: bool,
|
||||
pub image_src: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user