This commit is contained in:
fengchuanhn@gmail.com
2026-05-22 16:25:19 +08:00
parent c8d7d3e8f3
commit a2ff5b065e
4 changed files with 37 additions and 99 deletions

View File

@@ -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(())
}