feat: 添加PAYMENT_MAINTENANCE_MODE维护模式 + ServiceUnavailable错误
This commit is contained in:
@@ -16,8 +16,13 @@ pub async fn get_current_user_profile(
|
||||
info!("获取当前用户信息, 用户ID: {}", user_id);
|
||||
|
||||
let user = db::get_user_by_id(pool.get_ref(), user_id).await?;
|
||||
let is_paid_active = user.is_paid &&
|
||||
user.paid_expires_at.map_or(true, |expires| expires > chrono::Utc::now());
|
||||
let is_maintenance = std::env::var("PAYMENT_MAINTENANCE_MODE").ok() == Some("true".to_string());
|
||||
let is_paid_active = if is_maintenance {
|
||||
true
|
||||
} else {
|
||||
user.is_paid &&
|
||||
user.paid_expires_at.map_or(true, |expires| expires > chrono::Utc::now())
|
||||
};
|
||||
|
||||
Ok(HttpResponse::Ok().json(serde_json::json!({
|
||||
"success": true,
|
||||
|
||||
Reference in New Issue
Block a user