fix: 套餐定价更新+新增季卡/半年卡+SQL interval适配

This commit is contained in:
2026-05-26 15:44:50 +08:00
parent 87b17ad09e
commit 55259a96a6
2 changed files with 19 additions and 11 deletions

View File

@@ -530,6 +530,8 @@ async fn insert_payment_notification(pool: &PgPool, user_id: i32, order_no: &str
let pkg_label = match pkg_type.as_str() {
"monthly" => "包月会员",
"quarterly" => "季卡会员",
"half_year" => "半年会员",
"yearly" => "包年会员",
"permanent" => "永久会员",
_ => "会员",

View File

@@ -28,23 +28,29 @@ struct PackageInfo {
fn get_package_info(package_type: &str) -> Option<PackageInfo> {
match package_type {
"monthly" => Some(PackageInfo {
amount: 990,
display_amount: "9.9",
amount: 590,
display_amount: "5.9",
display_name: "包月会员",
days: Some(30),
}),
"quarterly" => Some(PackageInfo {
amount: 1680,
display_amount: "16.8",
display_name: "季卡会员",
days: Some(90),
}),
"half_year" => Some(PackageInfo {
amount: 3190,
display_amount: "31.9",
display_name: "半年会员",
days: Some(182),
}),
"yearly" => Some(PackageInfo {
amount: 5900,
display_amount: "59",
amount: 6020,
display_amount: "60.2",
display_name: "包年会员",
days: Some(365),
}),
"permanent" => Some(PackageInfo {
amount: 19900,
display_amount: "199",
display_name: "永久会员",
days: None,
}),
_ => None,
}
}
@@ -560,7 +566,7 @@ pub async fn payment_index() -> Result<HttpResponse, AppError> {
document.querySelectorAll('.pkg-card').forEach(c => c.classList.remove('selected'));
document.querySelector('[data-package="' + pkg + '"]').classList.add('selected');
var btn = document.getElementById('payBtn');
var labels = { monthly: '立即开通 - ¥9.9/', yearly: '立即开通 - ¥59/年' };
var labels = { monthly: '立即开通 - ¥5.9/月', quarterly: '立即开通 - ¥16.8/季', half_year: '立即开通 - ¥31.9/半年', yearly: '立即开通 - ¥60.2/年' };
btn.textContent = labels[pkg];
btn.disabled = false;
btn.className = 'btn-pay';