1
This commit is contained in:
@@ -42,7 +42,7 @@ pub struct PublicUserSearchResponse {
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PasswordEntryRequest {
|
||||
pub username: String,
|
||||
pub phone: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
@@ -193,12 +193,16 @@ pub struct WechatBindPhoneResponse {
|
||||
|
||||
pub fn build_available_login_methods(
|
||||
sms_auth_enabled: bool,
|
||||
password_auth_enabled: bool,
|
||||
wechat_auth_enabled: bool,
|
||||
) -> Vec<String> {
|
||||
let mut methods = vec![AUTH_LOGIN_METHOD_PASSWORD.to_string()];
|
||||
let mut methods = Vec::new();
|
||||
if sms_auth_enabled {
|
||||
methods.push(AUTH_LOGIN_METHOD_PHONE.to_string());
|
||||
}
|
||||
if password_auth_enabled {
|
||||
methods.push(AUTH_LOGIN_METHOD_PASSWORD.to_string());
|
||||
}
|
||||
if wechat_auth_enabled {
|
||||
methods.push(AUTH_LOGIN_METHOD_WECHAT.to_string());
|
||||
}
|
||||
@@ -212,13 +216,13 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn available_login_methods_keep_phone_then_wechat_order() {
|
||||
let methods = build_available_login_methods(true, true);
|
||||
let methods = build_available_login_methods(true, true, true);
|
||||
|
||||
assert_eq!(
|
||||
methods,
|
||||
vec![
|
||||
AUTH_LOGIN_METHOD_PASSWORD.to_string(),
|
||||
AUTH_LOGIN_METHOD_PHONE.to_string(),
|
||||
AUTH_LOGIN_METHOD_PASSWORD.to_string(),
|
||||
AUTH_LOGIN_METHOD_WECHAT.to_string()
|
||||
]
|
||||
);
|
||||
@@ -227,7 +231,7 @@ mod tests {
|
||||
#[test]
|
||||
fn password_entry_request_uses_camel_case_fields() {
|
||||
let payload = serde_json::to_value(PasswordEntryRequest {
|
||||
username: "guest_001".to_string(),
|
||||
phone: "13800138000".to_string(),
|
||||
password: "secret123".to_string(),
|
||||
})
|
||||
.expect("payload should serialize");
|
||||
@@ -235,7 +239,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
payload,
|
||||
json!({
|
||||
"username": "guest_001",
|
||||
"phone": "13800138000",
|
||||
"password": "secret123"
|
||||
})
|
||||
);
|
||||
|
||||
@@ -486,6 +486,7 @@ pub struct CustomWorldAgentOperationResponse {
|
||||
pub phase_detail: String,
|
||||
pub progress: u32,
|
||||
pub error: Option<String>,
|
||||
pub started_at: Option<String>,
|
||||
pub updated_at: Option<String>,
|
||||
}
|
||||
|
||||
@@ -782,15 +783,15 @@ mod tests {
|
||||
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,
|
||||
product_id: "points_60".to_string(),
|
||||
title: "60叙世币".to_string(),
|
||||
price_cents: 600,
|
||||
kind: "points".to_string(),
|
||||
points_amount: 10,
|
||||
bonus_points: 19,
|
||||
points_amount: 60,
|
||||
bonus_points: 60,
|
||||
duration_days: 0,
|
||||
badge_label: "首充送积分".to_string(),
|
||||
description: "首充送19积分".to_string(),
|
||||
badge_label: "首充双倍".to_string(),
|
||||
description: "首充送60叙世币".to_string(),
|
||||
tier: "normal".to_string(),
|
||||
}],
|
||||
membership_products: vec![],
|
||||
@@ -805,8 +806,8 @@ mod tests {
|
||||
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["pointProducts"][0]["productId"], json!("points_60"));
|
||||
assert_eq!(payload["pointProducts"][0]["priceCents"], json!(600));
|
||||
assert_eq!(payload["hasPointsRecharged"], json!(false));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user