todo: really fix UserLogoutApi
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize)]
|
||||||
@@ -13,7 +11,7 @@ pub struct UserLogoutApi {
|
|||||||
/// keychip without dash, 11 bytes
|
/// keychip without dash, 11 bytes
|
||||||
pub client_id: String,
|
pub client_id: String,
|
||||||
/// Unix timestamp
|
/// Unix timestamp
|
||||||
pub date_time: u64,
|
pub login_date_time: u64,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub type_: i64,
|
pub type_: i64,
|
||||||
}
|
}
|
||||||
@@ -27,19 +25,15 @@ pub struct UserLogoutApiResp {
|
|||||||
impl Default for UserLogoutApi {
|
impl Default for UserLogoutApi {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let user_id = 0;
|
let user_id = 0;
|
||||||
let date_time = SystemTime::now()
|
|
||||||
.duration_since(UNIX_EPOCH)
|
|
||||||
.map(|t| t.as_secs())
|
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
user_id,
|
user_id,
|
||||||
date_time,
|
|
||||||
region_id: 22,
|
region_id: 22,
|
||||||
place_id: 3490,
|
place_id: 3490,
|
||||||
client_id: "A63E01C2805".into(),
|
client_id: "A63E01C2805".into(),
|
||||||
type_: 1,
|
type_: 1,
|
||||||
access_code: "",
|
access_code: "",
|
||||||
|
|
||||||
|
login_date_time: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
|||||||
user_id,
|
user_id,
|
||||||
UserLogoutApi {
|
UserLogoutApi {
|
||||||
user_id,
|
user_id,
|
||||||
date_time: timestamp,
|
login_date_time: timestamp,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub async fn login_action<R>(
|
|||||||
action: impl AsyncFnOnce(UserLoginApiResp) -> R,
|
action: impl AsyncFnOnce(UserLoginApiResp) -> R,
|
||||||
) -> Result<R, ApiError> {
|
) -> Result<R, ApiError> {
|
||||||
let login = UserLoginApi::new(user_id, true, token);
|
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 =
|
let login_resp: UserLoginApiResp =
|
||||||
Sdgb1_53::request(&client, APIMethod::UserLoginApi, user_id, login).await?;
|
Sdgb1_53::request(&client, APIMethod::UserLoginApi, user_id, login).await?;
|
||||||
@@ -37,7 +37,7 @@ pub async fn login_action<R>(
|
|||||||
user_id,
|
user_id,
|
||||||
UserLogoutApi {
|
UserLogoutApi {
|
||||||
user_id,
|
user_id,
|
||||||
date_time,
|
login_date_time,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user