fix: 后台定时清理refresh_token+清理payment.rs死代码

This commit is contained in:
2026-06-05 22:35:02 +08:00
parent 955e8d9501
commit f8bee8f8b4
3 changed files with 3 additions and 22 deletions

View File

@@ -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;

View File

@@ -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<i64>,
}
@@ -31,28 +30,24 @@ fn get_package_info(package_type: &str) -> Option<PackageInfo> {
"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<String, String> {
let private_key = match RsaPrivateKey::from_pkcs8_pem(private_key_pem) {

View File

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