feat: preview user info
This commit is contained in:
@@ -7,6 +7,7 @@ license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
snafu = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
digest = "0.10.7"
|
||||
hmac-sha256 = { version = "1.1.12", features = ["digest010", "traits010"] }
|
||||
@@ -20,7 +21,6 @@ nyquest = { version = "0.2.0", features = ["async", "json"] }
|
||||
|
||||
# (de)serialization
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.141"
|
||||
|
||||
flate2 = "1.1.2"
|
||||
cbc = "0.1.2"
|
||||
|
||||
70
sdgb-api/src/title/model/get_user_preview_api/mod.rs
Normal file
70
sdgb-api/src/title/model/get_user_preview_api/mod.rs
Normal file
@@ -0,0 +1,70 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GetUserPreviewApi {
|
||||
pub user_id: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GetUserPreviewApiResp {
|
||||
pub user_id: i64,
|
||||
pub user_name: String,
|
||||
pub is_login: bool,
|
||||
pub last_rom_version: String,
|
||||
pub last_data_version: String,
|
||||
pub last_login_date: String,
|
||||
pub last_play_date: String,
|
||||
pub player_rating: i64,
|
||||
pub nameplate_id: i64,
|
||||
pub icon_id: i64,
|
||||
pub trophy_id: i64,
|
||||
pub is_net_member: i64,
|
||||
pub is_inherit: bool,
|
||||
pub total_awake: i64,
|
||||
pub disp_rate: i64,
|
||||
pub daily_bonus_date: String,
|
||||
pub ban_state: i64,
|
||||
// pub last_game_id: Value,
|
||||
// pub head_phone_volume: Value,
|
||||
}
|
||||
|
||||
impl Display for GetUserPreviewApiResp {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_fmt(format_args!("ID: {}\n", self.user_id))?;
|
||||
f.write_fmt(format_args!("昵称: {}\n", self.user_name))?;
|
||||
f.write_fmt(format_args!("登录中: {}\n", self.is_login))?;
|
||||
|
||||
f.write_fmt(format_args!("上次游戏版本: {}\n", self.last_rom_version))?;
|
||||
f.write_fmt(format_args!("上次数据版本: {}\n", self.last_data_version))?;
|
||||
|
||||
f.write_fmt(format_args!("DX Rating: {}\n", self.player_rating))?;
|
||||
f.write_fmt(format_args!("牌子: {}\n", self.nameplate_id))?;
|
||||
f.write_fmt(format_args!("图标: {}\n", self.icon_id))?;
|
||||
f.write_fmt(format_args!("trophy: {}\n", self.trophy_id))?;
|
||||
f.write_fmt(format_args!("Net成员: {}\n", self.is_net_member))?;
|
||||
f.write_fmt(format_args!("继承账号: {}\n", self.is_inherit))?;
|
||||
f.write_fmt(format_args!("总觉醒: {}\n", self.total_awake))?;
|
||||
|
||||
f.write_fmt(format_args!(
|
||||
"状态显示: {}\n",
|
||||
match self.disp_rate {
|
||||
0 => "全部都显示",
|
||||
1 => "显示评级和段位",
|
||||
2 => "显示评级和阶级",
|
||||
3 => "显示段位和阶级",
|
||||
4 => "只显示评级",
|
||||
5 => "只显示段位",
|
||||
6 => "只显示阶级",
|
||||
7 => "全部都不显示",
|
||||
_ => "未知",
|
||||
}
|
||||
))?;
|
||||
|
||||
f.write_fmt(format_args!("封禁状态: {}\n", self.ban_state))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -2,3 +2,6 @@ use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct Ping {}
|
||||
|
||||
mod get_user_preview_api;
|
||||
pub use get_user_preview_api::{GetUserPreviewApi, GetUserPreviewApiResp};
|
||||
|
||||
Reference in New Issue
Block a user