This commit is contained in:
2026-05-14 14:21:17 +08:00
parent 7a75f5d612
commit d33c937ebc
191 changed files with 1916 additions and 1549 deletions

View File

@@ -30,7 +30,7 @@ where
.await
}
/// 生图等特殊操作可声明独立点成本,避免修改全局资产操作默认价格。
/// 生图等特殊操作可声明独立点成本,避免修改全局资产操作默认价格。
pub(crate) async fn execute_billable_asset_operation_with_cost<T, Fut>(
state: &AppState,
owner_user_id: &str,
@@ -63,7 +63,7 @@ where
}
}
/// 资产操作统一预扣点;扣费流水 ID 由业务资源 ID 参与构造,保证重试幂等。
/// 资产操作统一预扣点;扣费流水 ID 由业务资源 ID 参与构造,保证重试幂等。
async fn consume_asset_operation_points(
state: &AppState,
owner_user_id: &str,
@@ -93,7 +93,7 @@ async fn consume_asset_operation_points(
asset_kind,
asset_id,
error = %error,
"资产操作点预扣因 SpacetimeDB 连接不可用而降级跳过"
"资产操作点预扣因 SpacetimeDB 连接不可用而降级跳过"
);
Ok(false)
}
@@ -128,7 +128,7 @@ async fn refund_asset_operation_points(
asset_kind,
asset_id,
error = %error,
"资产操作失败后的点退款失败"
"资产操作失败后的点退款失败"
);
}
}
@@ -138,10 +138,10 @@ pub(crate) fn map_asset_operation_wallet_error(error: SpacetimeClientError) -> A
tracing::warn!(
provider = "profile-wallet",
error = %message,
"资产操作点预扣失败"
"资产操作点预扣失败"
);
let status = match &error {
SpacetimeClientError::Procedure(message) if message.contains("点余额不足") => {
SpacetimeClientError::Procedure(message) if message.contains("点余额不足") => {
StatusCode::CONFLICT
}
_ => StatusCode::BAD_GATEWAY,
@@ -191,7 +191,7 @@ mod tests {
),
));
assert!(!should_skip_asset_operation_billing_for_connectivity(
&SpacetimeClientError::Procedure("点余额不足".to_string()),
&SpacetimeClientError::Procedure("点余额不足".to_string()),
));
}
}