fix: 添加后台定时重试 + 管理员强制确认 + 审计日志 + mock守卫

This commit is contained in:
2026-05-25 13:04:19 +08:00
parent af2837e15e
commit 5f3b919e92
7 changed files with 284 additions and 9 deletions

View File

@@ -1173,12 +1173,17 @@ pub async fn payment_login_status(
let user_id = user_id.unwrap();
let (is_paid_active, paid_expires_at): (bool, Option<String>) =
match sqlx::query_as::<_, (bool, Option<chrono::DateTime<chrono::Utc>>)>("SELECT is_paid_active($1)")
match sqlx::query_as::<_, (bool, Option<chrono::DateTime<chrono::Utc>>)>(
"SELECT is_paid, paid_expires_at FROM users WHERE id = $1"
)
.bind(user_id)
.fetch_optional(pool.get_ref())
.await
{
Ok(Some((active, expires))) => (active, expires.map(|e| e.to_rfc3339())),
Ok(Some((is_paid, expires))) => {
let active = is_paid && expires.map_or(true, |e| e > Utc::now());
(active, expires.map(|e| e.to_rfc3339()))
}
_ => (false, None),
};