fix: get_user_quota 返回 was_paid 字段
This commit is contained in:
@@ -682,12 +682,12 @@ pub async fn refund_payment_order(
|
||||
pub async fn get_user_quota(
|
||||
pool: &PgPool,
|
||||
user_id: i32,
|
||||
) -> Result<(i64, bool, Option<chrono::DateTime<chrono::Utc>>), AppError> {
|
||||
) -> Result<(i64, bool, Option<chrono::DateTime<chrono::Utc>>, bool), AppError> {
|
||||
let user = get_user_by_id(pool, user_id).await?;
|
||||
let is_paid_active = user.is_paid
|
||||
&& user.paid_expires_at.map_or(true, |expires| expires > chrono::Utc::now());
|
||||
let used = count_user_weather_data(pool, user_id).await?;
|
||||
Ok((used, is_paid_active, user.paid_expires_at))
|
||||
Ok((used, is_paid_active, user.paid_expires_at, user.is_paid))
|
||||
}
|
||||
|
||||
// ===== 收藏功能 DB 函数 =====
|
||||
|
||||
Reference in New Issue
Block a user