1
This commit is contained in:
@@ -15,6 +15,7 @@ pub const DEFAULT_PLATFORM_THEME: RuntimePlatformTheme = RuntimePlatformTheme::L
|
||||
pub const DEFAULT_BROWSE_HISTORY_AUTHOR_DISPLAY_NAME: &str = "玩家";
|
||||
pub const MAX_BROWSE_HISTORY_BATCH_SIZE: usize = 100;
|
||||
pub const PROFILE_WALLET_LEDGER_LIST_LIMIT: usize = 50;
|
||||
pub const PROFILE_NEW_USER_INITIAL_WALLET_POINTS: u64 = 10;
|
||||
pub const PROFILE_REFERRAL_REWARD_POINTS: u64 = 30;
|
||||
pub const PROFILE_REFERRAL_DAILY_INVITER_REWARD_LIMIT: u32 = 10;
|
||||
pub const PROFILE_INVITE_CODE_METADATA_DEFAULT_JSON: &str = "{}";
|
||||
@@ -258,6 +259,7 @@ pub struct RuntimeProfileDashboardGetInput {
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum RuntimeProfileWalletLedgerSourceType {
|
||||
SnapshotSync,
|
||||
NewUserRegistrationReward,
|
||||
InviteInviterReward,
|
||||
InviteInviteeReward,
|
||||
PointsRecharge,
|
||||
@@ -532,6 +534,15 @@ pub struct RuntimeProfileInviteCodeAdminProcedureResult {
|
||||
pub error_message: Option<String>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RuntimeReferralInvitedUserSnapshot {
|
||||
pub user_id: String,
|
||||
pub display_name: String,
|
||||
pub avatar_url: Option<String>,
|
||||
pub bound_at_micros: i64,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RuntimeReferralInviteCenterSnapshot {
|
||||
@@ -543,6 +554,7 @@ pub struct RuntimeReferralInviteCenterSnapshot {
|
||||
pub today_inviter_reward_count: u32,
|
||||
pub today_inviter_reward_remaining: u32,
|
||||
pub reward_points: u64,
|
||||
pub invited_users: Vec<RuntimeReferralInvitedUserSnapshot>,
|
||||
pub has_redeemed_code: bool,
|
||||
pub bound_inviter_user_id: Option<String>,
|
||||
pub bound_at_micros: Option<i64>,
|
||||
@@ -958,6 +970,15 @@ pub struct RuntimeProfileInviteCodeRecord {
|
||||
pub updated_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct RuntimeReferralInvitedUserRecord {
|
||||
pub user_id: String,
|
||||
pub display_name: String,
|
||||
pub avatar_url: Option<String>,
|
||||
pub bound_at: String,
|
||||
pub bound_at_micros: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct RuntimeReferralInviteCenterRecord {
|
||||
pub user_id: String,
|
||||
@@ -968,6 +989,7 @@ pub struct RuntimeReferralInviteCenterRecord {
|
||||
pub today_inviter_reward_count: u32,
|
||||
pub today_inviter_reward_remaining: u32,
|
||||
pub reward_points: u64,
|
||||
pub invited_users: Vec<RuntimeReferralInvitedUserRecord>,
|
||||
pub has_redeemed_code: bool,
|
||||
pub bound_inviter_user_id: Option<String>,
|
||||
pub bound_at: Option<String>,
|
||||
@@ -1534,6 +1556,17 @@ pub fn build_runtime_referral_invite_center_record(
|
||||
today_inviter_reward_count: snapshot.today_inviter_reward_count,
|
||||
today_inviter_reward_remaining: snapshot.today_inviter_reward_remaining,
|
||||
reward_points: snapshot.reward_points,
|
||||
invited_users: snapshot
|
||||
.invited_users
|
||||
.into_iter()
|
||||
.map(|user| RuntimeReferralInvitedUserRecord {
|
||||
user_id: user.user_id,
|
||||
display_name: user.display_name,
|
||||
avatar_url: user.avatar_url,
|
||||
bound_at: format_utc_micros(user.bound_at_micros),
|
||||
bound_at_micros: user.bound_at_micros,
|
||||
})
|
||||
.collect(),
|
||||
has_redeemed_code: snapshot.has_redeemed_code,
|
||||
bound_inviter_user_id: snapshot.bound_inviter_user_id,
|
||||
bound_at: snapshot.bound_at_micros.map(format_utc_micros),
|
||||
@@ -1778,6 +1811,7 @@ impl RuntimeProfileWalletLedgerSourceType {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::SnapshotSync => "snapshot_sync",
|
||||
Self::NewUserRegistrationReward => "new_user_registration_reward",
|
||||
Self::InviteInviterReward => "invite_inviter_reward",
|
||||
Self::InviteInviteeReward => "invite_invitee_reward",
|
||||
Self::PointsRecharge => "points_recharge",
|
||||
@@ -1840,57 +1874,57 @@ pub fn runtime_profile_recharge_point_products() -> Vec<RuntimeProfileRechargePr
|
||||
vec![
|
||||
build_points_recharge_product(
|
||||
"points_60",
|
||||
"60陶泥币",
|
||||
"60光点",
|
||||
600,
|
||||
60,
|
||||
60,
|
||||
"首充双倍",
|
||||
"首充送60陶泥币",
|
||||
"首充送60光点",
|
||||
),
|
||||
build_points_recharge_product(
|
||||
"points_180",
|
||||
"180陶泥币",
|
||||
"180光点",
|
||||
1800,
|
||||
180,
|
||||
180,
|
||||
"首充双倍",
|
||||
"首充送180陶泥币",
|
||||
"首充送180光点",
|
||||
),
|
||||
build_points_recharge_product(
|
||||
"points_300",
|
||||
"300陶泥币",
|
||||
"300光点",
|
||||
3000,
|
||||
300,
|
||||
300,
|
||||
"首充双倍",
|
||||
"首充送300陶泥币",
|
||||
"首充送300光点",
|
||||
),
|
||||
build_points_recharge_product(
|
||||
"points_680",
|
||||
"680陶泥币",
|
||||
"680光点",
|
||||
6800,
|
||||
680,
|
||||
680,
|
||||
"首充双倍",
|
||||
"首充送680陶泥币",
|
||||
"首充送680光点",
|
||||
),
|
||||
build_points_recharge_product(
|
||||
"points_1280",
|
||||
"1280陶泥币",
|
||||
"1280光点",
|
||||
12800,
|
||||
1280,
|
||||
1280,
|
||||
"首充双倍",
|
||||
"首充送1280陶泥币",
|
||||
"首充送1280光点",
|
||||
),
|
||||
build_points_recharge_product(
|
||||
"points_3280",
|
||||
"3280陶泥币",
|
||||
"3280光点",
|
||||
32800,
|
||||
3280,
|
||||
3280,
|
||||
"首充双倍",
|
||||
"首充送3280陶泥币",
|
||||
"首充送3280光点",
|
||||
),
|
||||
]
|
||||
}
|
||||
@@ -1939,7 +1973,7 @@ pub fn runtime_profile_membership_benefits() -> Vec<RuntimeProfileMembershipBene
|
||||
year_value: "¥248".to_string(),
|
||||
},
|
||||
RuntimeProfileMembershipBenefitSnapshot {
|
||||
benefit_name: "免陶泥币回合数".to_string(),
|
||||
benefit_name: "免光点回合数".to_string(),
|
||||
normal_value: "30".to_string(),
|
||||
month_value: "100".to_string(),
|
||||
season_value: "100".to_string(),
|
||||
@@ -2354,6 +2388,10 @@ mod tests {
|
||||
RuntimeProfileWalletLedgerSourceType::SnapshotSync.as_str(),
|
||||
"snapshot_sync"
|
||||
);
|
||||
assert_eq!(
|
||||
RuntimeProfileWalletLedgerSourceType::NewUserRegistrationReward.as_str(),
|
||||
"new_user_registration_reward"
|
||||
);
|
||||
assert_eq!(
|
||||
RuntimeProfileWalletLedgerSourceType::PointsRecharge.as_str(),
|
||||
"points_recharge"
|
||||
@@ -2379,14 +2417,14 @@ mod tests {
|
||||
|
||||
assert_eq!(point_products.len(), 6);
|
||||
assert_eq!(point_products[0].product_id, "points_60");
|
||||
assert_eq!(point_products[0].title, "60陶泥币");
|
||||
assert_eq!(point_products[0].title, "60光点");
|
||||
assert_eq!(point_products[0].price_cents, 600);
|
||||
assert_eq!(point_products[0].bonus_points, 60);
|
||||
assert_eq!(point_products[0].description, "首充送60陶泥币");
|
||||
assert_eq!(point_products[0].description, "首充送60光点");
|
||||
assert_eq!(point_products[5].product_id, "points_3280");
|
||||
assert_eq!(point_products[5].price_cents, 32800);
|
||||
assert_eq!(point_products[5].bonus_points, 3280);
|
||||
assert_eq!(point_products[5].description, "首充送3280陶泥币");
|
||||
assert_eq!(point_products[5].description, "首充送3280光点");
|
||||
assert_eq!(membership_products.len(), 3);
|
||||
assert_eq!(membership_products[0].title, "月卡");
|
||||
assert_eq!(membership_products[0].price_cents, 2800);
|
||||
@@ -2396,7 +2434,7 @@ mod tests {
|
||||
assert!(
|
||||
benefits
|
||||
.iter()
|
||||
.any(|benefit| benefit.benefit_name == "免陶泥币回合数")
|
||||
.any(|benefit| benefit.benefit_name == "免光点回合数")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user