1
This commit is contained in:
@@ -160,19 +160,17 @@ pub async fn send_heartbeat(token: &str) -> Result<(), String> {
|
||||
|
||||
let server_code = response_server_verify_code(&value);
|
||||
if server_code != Some(expected.as_str()) {
|
||||
|
||||
return Err("会员已过期".into());
|
||||
}
|
||||
|
||||
if let Some(ok) = value.get("ok").and_then(|v| v.as_bool()) {
|
||||
if !ok {
|
||||
let msg = value
|
||||
.get("message")
|
||||
.and_then(|m| m.as_str())
|
||||
.unwrap_or("心跳校验失败");
|
||||
return Err(msg.to_string());
|
||||
}
|
||||
if value.get("ok").and_then(|v| v.as_bool()) == Some(false) {
|
||||
let msg = value
|
||||
.get("message")
|
||||
.and_then(|m| m.as_str())
|
||||
.unwrap_or("心跳校验失败");
|
||||
return Err(msg.to_string());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user