This commit is contained in:
2026-04-25 22:19:04 +08:00
parent 2ebfd1cf55
commit 8404081d7b
149 changed files with 10508 additions and 2732 deletions

View File

@@ -0,0 +1,26 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ParseCreationAgentDocumentInputRequest {
pub file_name: String,
#[serde(default)]
pub content_type: Option<String>,
pub content_base64: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct CreationAgentDocumentInputPayload {
pub file_name: String,
#[serde(default)]
pub content_type: Option<String>,
pub size_bytes: usize,
pub text: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ParseCreationAgentDocumentInputResponse {
pub document: CreationAgentDocumentInputPayload,
}

View File

@@ -5,6 +5,7 @@ pub mod assets;
pub mod auth;
pub mod big_fish;
pub mod big_fish_works;
pub mod creation_agent_document_input;
pub mod llm;
pub mod puzzle_agent;
pub mod puzzle_gallery;

View File

@@ -4,6 +4,7 @@ pub const RUNTIME_PLATFORM_THEME_LIGHT: &str = "light";
pub const RUNTIME_PLATFORM_THEME_DARK: &str = "dark";
pub const SAVE_SNAPSHOT_VERSION: u32 = 2;
pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_SNAPSHOT_SYNC: &str = "snapshot_sync";
pub const PROFILE_WALLET_LEDGER_SOURCE_TYPE_POINTS_RECHARGE: &str = "points_recharge";
pub const BROWSE_HISTORY_THEME_MODE_MARTIAL: &str = "martial";
pub const BROWSE_HISTORY_THEME_MODE_ARCANE: &str = "arcane";
pub const BROWSE_HISTORY_THEME_MODE_MACHINA: &str = "machina";
@@ -141,6 +142,84 @@ pub struct ProfileWalletLedgerResponse {
pub entries: Vec<ProfileWalletLedgerEntryResponse>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileRechargeProductResponse {
pub product_id: String,
pub title: String,
pub price_cents: u64,
pub kind: String,
pub points_amount: u64,
pub bonus_points: u64,
pub duration_days: u32,
pub badge_label: String,
pub description: String,
pub tier: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileMembershipBenefitResponse {
pub benefit_name: String,
pub normal_value: String,
pub month_value: String,
pub season_value: String,
pub year_value: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileMembershipResponse {
pub status: String,
pub tier: String,
pub started_at: Option<String>,
pub expires_at: Option<String>,
pub updated_at: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileRechargeOrderResponse {
pub order_id: String,
pub product_id: String,
pub product_title: String,
pub kind: String,
pub amount_cents: u64,
pub status: String,
pub payment_channel: String,
pub paid_at: String,
pub created_at: String,
pub points_delta: i64,
pub membership_expires_at: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfileRechargeCenterResponse {
pub wallet_balance: u64,
pub membership: ProfileMembershipResponse,
pub point_products: Vec<ProfileRechargeProductResponse>,
pub membership_products: Vec<ProfileRechargeProductResponse>,
pub benefits: Vec<ProfileMembershipBenefitResponse>,
pub latest_order: Option<ProfileRechargeOrderResponse>,
pub has_points_recharged: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CreateProfileRechargeOrderRequest {
pub product_id: String,
#[serde(default)]
pub payment_channel: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct CreateProfileRechargeOrderResponse {
pub order: ProfileRechargeOrderResponse,
pub center: ProfileRechargeCenterResponse,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ProfilePlayedWorkSummaryResponse {
@@ -373,6 +452,7 @@ pub struct CustomWorldAgentOperationResponse {
pub phase_detail: String,
pub progress: u32,
pub error: Option<String>,
pub updated_at: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
@@ -656,6 +736,57 @@ mod tests {
);
}
#[test]
fn profile_recharge_center_response_uses_camel_case_fields() {
let payload = serde_json::to_value(ProfileRechargeCenterResponse {
wallet_balance: 29,
membership: ProfileMembershipResponse {
status: "active".to_string(),
tier: "month".to_string(),
started_at: Some("2026-04-25T10:00:00Z".to_string()),
expires_at: Some("2026-05-25T10:00:00Z".to_string()),
updated_at: Some("2026-04-25T10:00:00Z".to_string()),
},
point_products: vec![ProfileRechargeProductResponse {
product_id: "points_10".to_string(),
title: "10积分".to_string(),
price_cents: 100,
kind: "points".to_string(),
points_amount: 10,
bonus_points: 19,
duration_days: 0,
badge_label: "首充送积分".to_string(),
description: "首充送19积分".to_string(),
tier: "normal".to_string(),
}],
membership_products: vec![],
benefits: vec![],
latest_order: None,
has_points_recharged: false,
})
.expect("payload should serialize");
assert_eq!(payload["walletBalance"], json!(29));
assert_eq!(
payload["membership"]["expiresAt"],
json!("2026-05-25T10:00:00Z")
);
assert_eq!(payload["pointProducts"][0]["productId"], json!("points_10"));
assert_eq!(payload["pointProducts"][0]["priceCents"], json!(100));
assert_eq!(payload["hasPointsRecharged"], json!(false));
}
#[test]
fn create_profile_recharge_order_request_accepts_optional_channel() {
let payload: CreateProfileRechargeOrderRequest = serde_json::from_value(json!({
"productId": "member_month"
}))
.expect("request should deserialize");
assert_eq!(payload.product_id, "member_month");
assert_eq!(payload.payment_channel, None);
}
#[test]
fn profile_play_stats_response_uses_camel_case_fields() {
let payload = serde_json::to_value(ProfilePlayStatsResponse {