todo: really fix UserLogoutApi

This commit is contained in:
2026-01-21 03:54:28 +08:00
parent 9a5278c3a7
commit 30039a269c
3 changed files with 6 additions and 12 deletions

View File

@@ -1,5 +1,3 @@
use std::time::{SystemTime, UNIX_EPOCH};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize)]
@@ -13,7 +11,7 @@ pub struct UserLogoutApi {
/// keychip without dash, 11 bytes
pub client_id: String,
/// Unix timestamp
pub date_time: u64,
pub login_date_time: u64,
#[serde(rename = "type")]
pub type_: i64,
}
@@ -27,19 +25,15 @@ pub struct UserLogoutApiResp {
impl Default for UserLogoutApi {
fn default() -> Self {
let user_id = 0;
let date_time = SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|t| t.as_secs())
.unwrap_or_default();
Self {
user_id,
date_time,
region_id: 22,
place_id: 3490,
client_id: "A63E01C2805".into(),
type_: 1,
access_code: "",
login_date_time: 0,
}
}
}

View File

@@ -153,7 +153,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
user_id,
UserLogoutApi {
user_id,
date_time: timestamp,
login_date_time: timestamp,
..Default::default()
},
)

View File

@@ -19,7 +19,7 @@ pub async fn login_action<R>(
action: impl AsyncFnOnce(UserLoginApiResp) -> R,
) -> Result<R, ApiError> {
let login = UserLoginApi::new(user_id, true, token);
let date_time = login.date_time;
let login_date_time = login.date_time;
let login_resp: UserLoginApiResp =
Sdgb1_53::request(&client, APIMethod::UserLoginApi, user_id, login).await?;
@@ -37,7 +37,7 @@ pub async fn login_action<R>(
user_id,
UserLogoutApi {
user_id,
date_time,
login_date_time,
..Default::default()
},
)