拆分大文件
This commit is contained in:
@@ -652,10 +652,10 @@ pub fn build_runtime_snapshot_upsert_input(
|
||||
updated_at_micros: i64,
|
||||
) -> Result<RuntimeSnapshotUpsertInput, RuntimeProfileFieldError> {
|
||||
let user_id = normalize_runtime_profile_user_id(user_id)?;
|
||||
let bottom_tab = normalize_bottom_tab(bottom_tab)
|
||||
.ok_or(RuntimeProfileFieldError::MissingBottomTab)?;
|
||||
let game_state_json =
|
||||
serde_json::to_string(&game_state).map_err(|_| RuntimeProfileFieldError::InvalidGameStateJson)?;
|
||||
let bottom_tab =
|
||||
normalize_bottom_tab(bottom_tab).ok_or(RuntimeProfileFieldError::MissingBottomTab)?;
|
||||
let game_state_json = serde_json::to_string(&game_state)
|
||||
.map_err(|_| RuntimeProfileFieldError::InvalidGameStateJson)?;
|
||||
let current_story_json = normalize_current_story_json(current_story)?;
|
||||
|
||||
Ok(RuntimeSnapshotUpsertInput {
|
||||
@@ -1012,7 +1012,9 @@ impl std::fmt::Display for RuntimeProfileFieldError {
|
||||
Self::MissingUserId => f.write_str("profile.user_id 不能为空"),
|
||||
Self::MissingWorldKey => f.write_str("profile.world_key 不能为空"),
|
||||
Self::MissingBottomTab => f.write_str("runtime_snapshot.bottom_tab 不能为空"),
|
||||
Self::InvalidGameStateJson => f.write_str("runtime_snapshot.game_state 必须是合法 JSON"),
|
||||
Self::InvalidGameStateJson => {
|
||||
f.write_str("runtime_snapshot.game_state 必须是合法 JSON")
|
||||
}
|
||||
Self::InvalidCurrentStoryJson => {
|
||||
f.write_str("runtime_snapshot.current_story 必须是合法 JSON object 或 null")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user