feat: 支持充值商品配置和档位首充
This commit is contained in:
@@ -657,6 +657,78 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn admin_list_profile_recharge_products(
|
||||
&self,
|
||||
admin_user_id: String,
|
||||
) -> Result<Vec<RuntimeProfileRechargeProductConfigRecord>, SpacetimeClientError> {
|
||||
let procedure_input =
|
||||
build_runtime_profile_recharge_product_admin_list_input(admin_user_id)
|
||||
.map_err(SpacetimeClientError::validation_failed)?
|
||||
.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.admin_list_profile_recharge_products_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_runtime_profile_recharge_product_admin_list_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn admin_upsert_profile_recharge_product(
|
||||
&self,
|
||||
admin_user_id: String,
|
||||
product_id: String,
|
||||
title: String,
|
||||
price_cents: u64,
|
||||
kind: module_runtime::RuntimeProfileRechargeProductKind,
|
||||
points_amount: u64,
|
||||
bonus_points: u64,
|
||||
duration_days: u32,
|
||||
badge_label: String,
|
||||
description: String,
|
||||
tier: module_runtime::RuntimeProfileMembershipTier,
|
||||
enabled: bool,
|
||||
sort_order: i32,
|
||||
updated_at_micros: i64,
|
||||
) -> Result<RuntimeProfileRechargeProductConfigRecord, SpacetimeClientError> {
|
||||
let procedure_input = build_runtime_profile_recharge_product_admin_upsert_input(
|
||||
admin_user_id,
|
||||
product_id,
|
||||
title,
|
||||
price_cents,
|
||||
kind,
|
||||
points_amount,
|
||||
bonus_points,
|
||||
duration_days,
|
||||
badge_label,
|
||||
description,
|
||||
tier,
|
||||
enabled,
|
||||
sort_order,
|
||||
updated_at_micros,
|
||||
)
|
||||
.map_err(SpacetimeClientError::validation_failed)?
|
||||
.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.admin_upsert_profile_recharge_product_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_runtime_profile_recharge_product_admin_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn admin_upsert_profile_redeem_code(
|
||||
&self,
|
||||
admin_user_id: String,
|
||||
|
||||
Reference in New Issue
Block a user