feat: implement GetUserRatingApi
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,3 +4,5 @@
|
|||||||
|
|
||||||
/players.redb
|
/players.redb
|
||||||
/players.json*
|
/players.json*
|
||||||
|
|
||||||
|
/*.json
|
||||||
@@ -75,6 +75,7 @@ api_implement!([
|
|||||||
"UserLogoutApi",
|
"UserLogoutApi",
|
||||||
"GetUserDataApi",
|
"GetUserDataApi",
|
||||||
"GetUserPreviewApi",
|
"GetUserPreviewApi",
|
||||||
|
"GetUserRatingApi",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
85
sdgb-api/src/title/model/get_user_rating_api/mod.rs
Normal file
85
sdgb-api/src/title/model/get_user_rating_api/mod.rs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
use serde::Deserialize;
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct GetUserRatingApi {
|
||||||
|
pub user_id: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct GetUserRatingApiResp {
|
||||||
|
pub user_id: u32,
|
||||||
|
pub user_rating: UserRating,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct UserRating {
|
||||||
|
pub rating: i64,
|
||||||
|
/// b35
|
||||||
|
pub rating_list: Vec<RatingList>,
|
||||||
|
/// b15
|
||||||
|
pub new_rating_list: Vec<RatingList>,
|
||||||
|
/// 候补 b35
|
||||||
|
pub next_rating_list: Vec<RatingList>,
|
||||||
|
/// 候补 b15
|
||||||
|
pub next_new_rating_list: Vec<RatingList>,
|
||||||
|
pub udemae: Udemae,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct RatingList {
|
||||||
|
/// Maimai music id
|
||||||
|
pub music_id: u32,
|
||||||
|
/// difficulty
|
||||||
|
///
|
||||||
|
/// - 0: BASIC
|
||||||
|
/// - 1: ADVANCED
|
||||||
|
/// - 2: EXPERT
|
||||||
|
/// - 3: MASTER
|
||||||
|
/// - 4: RE: MASTER
|
||||||
|
/// - 5: Utage 宴会场
|
||||||
|
pub level: u32,
|
||||||
|
/// 歌曲 ROM 版本(解析未知)
|
||||||
|
pub rom_version: i64,
|
||||||
|
/// 达成率 * 10000 的整数
|
||||||
|
pub achievement: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Udemae {
|
||||||
|
pub max_lose_num: i64,
|
||||||
|
pub npc_total_win_num: i64,
|
||||||
|
pub npc_total_lose_num: i64,
|
||||||
|
pub npc_max_win_num: i64,
|
||||||
|
pub npc_max_lose_num: i64,
|
||||||
|
pub npc_win_num: i64,
|
||||||
|
pub npc_lose_num: i64,
|
||||||
|
pub rate: i64,
|
||||||
|
pub class_value: i64,
|
||||||
|
pub max_rate: i64,
|
||||||
|
pub max_class_value: i64,
|
||||||
|
pub total_win_num: i64,
|
||||||
|
pub total_lose_num: i64,
|
||||||
|
pub max_win_num: i64,
|
||||||
|
pub win_num: i64,
|
||||||
|
pub lose_num: i64,
|
||||||
|
#[serde(rename = "MaxLoseNum")]
|
||||||
|
pub max_lose_num2: i64,
|
||||||
|
#[serde(rename = "NpcTotalWinNum")]
|
||||||
|
pub npc_total_win_num2: i64,
|
||||||
|
#[serde(rename = "NpcTotalLoseNum")]
|
||||||
|
pub npc_total_lose_num2: i64,
|
||||||
|
#[serde(rename = "NpcMaxWinNum")]
|
||||||
|
pub npc_max_win_num2: i64,
|
||||||
|
#[serde(rename = "NpcMaxLoseNum")]
|
||||||
|
pub npc_max_lose_num2: i64,
|
||||||
|
#[serde(rename = "NpcWinNum")]
|
||||||
|
pub npc_win_num2: i64,
|
||||||
|
#[serde(rename = "NpcLoseNum")]
|
||||||
|
pub npc_lose_num2: i64,
|
||||||
|
}
|
||||||
@@ -12,3 +12,6 @@ pub use user_login_api::{LoginError, UserLoginApi, UserLoginApiResp};
|
|||||||
|
|
||||||
mod get_user_data_api;
|
mod get_user_data_api;
|
||||||
pub use get_user_data_api::{GetUserDataApi, GetUserDataApiResp};
|
pub use get_user_data_api::{GetUserDataApi, GetUserDataApiResp};
|
||||||
|
|
||||||
|
mod get_user_rating_api;
|
||||||
|
pub use get_user_rating_api::{GetUserRatingApi, GetUserRatingApiResp};
|
||||||
|
|||||||
Reference in New Issue
Block a user