From f8bee8f8b40d9acc871ad7626955e487cdcdd095 Mon Sep 17 00:00:00 2001 From: milky0217 Date: Fri, 5 Jun 2026 22:35:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=90=8E=E5=8F=B0=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=90=86refresh=5Ftoken+=E6=B8=85=E7=90=86payment.rs?= =?UTF-8?q?=E6=AD=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/handlers/notifications.rs | 1 - src/handlers/payment.rs | 21 --------------------- src/main.rs | 3 +++ 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/handlers/notifications.rs b/src/handlers/notifications.rs index bfe24ed..77c3e3c 100644 --- a/src/handlers/notifications.rs +++ b/src/handlers/notifications.rs @@ -2,7 +2,6 @@ use actix_web::{web, get, put, post, delete, HttpResponse}; use serde::Deserialize; use sqlx::postgres::PgPool; -use chrono::Utc; use crate::db; use crate::error::AppError; diff --git a/src/handlers/payment.rs b/src/handlers/payment.rs index 21e64f0..b5778e1 100644 --- a/src/handlers/payment.rs +++ b/src/handlers/payment.rs @@ -21,7 +21,6 @@ use crate::models::{Claims, CreateOrderRequest, MockConfirmRequest}; struct PackageInfo { amount: i32, display_amount: &'static str, - original_amount: &'static str, display_name: &'static str, days: Option, } @@ -31,28 +30,24 @@ fn get_package_info(package_type: &str) -> Option { "monthly" => Some(PackageInfo { amount: 590, display_amount: "5.9", - original_amount: "9.9", display_name: "包月会员", days: Some(30), }), "quarterly" => Some(PackageInfo { amount: 1680, display_amount: "16.8", - original_amount: "29", display_name: "季卡会员", days: Some(90), }), "half_year" => Some(PackageInfo { amount: 3190, display_amount: "31.9", - original_amount: "49", display_name: "半年会员", days: Some(182), }), "yearly" => Some(PackageInfo { amount: 6020, display_amount: "60.2", - original_amount: "99", display_name: "包年会员", days: Some(365), }), @@ -81,22 +76,6 @@ impl AlipayConfig { } } -/// URL 编码(RFC 3986) -fn urlencoding(s: &str) -> String { - let mut result = String::new(); - for c in s.chars() { - match c { - 'A'..='Z' | 'a'..='z' | '0'..='9' | '-' | '_' | '.' | '~' => result.push(c), - _ => { - for b in c.to_string().as_bytes() { - result.push_str(&format!("%{:02X}", b)); - } - } - } - } - result -} - /// RSA2 (SHA256) 签名 fn rsa2_sign(content: &str, private_key_pem: &str) -> Result { let private_key = match RsaPrivateKey::from_pkcs8_pem(private_key_pem) { diff --git a/src/main.rs b/src/main.rs index 99a02c6..e31afd9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -270,6 +270,9 @@ async fn main() -> std::io::Result<()> { // 会员到期前 7 天提醒 let _ = db::check_member_expiry_soon(&pool_clone).await; + + // 清理过期的 refresh_token + let _ = db::cleanup_expired_refresh_tokens(&pool_clone).await; } });