From 6d066c8e826102411c181078a3a1ada3cf491b56 Mon Sep 17 00:00:00 2001 From: milky0217 Date: Wed, 17 Jun 2026 13:32:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E5=8C=BA=E5=88=86=E5=B7=B2?= =?UTF-8?q?=E6=94=AF=E4=BB=98/=E5=B7=B2=E5=8F=96=E6=B6=88=E7=8A=B6?= =?UTF-8?q?=E6=80=81+=E6=94=AF=E4=BB=98=E7=A1=AE=E8=AE=A4=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/db.rs b/src/db.rs index 182897f..f6fe9ef 100644 --- a/src/db.rs +++ b/src/db.rs @@ -578,7 +578,14 @@ pub async fn confirm_payment_order( } if status != "pending" { - return Err(AppError::BadRequest("订单状态异常,无法确认支付".to_string())); + let hint = if status == "paid" { + "该订单已支付成功,无需重复操作" + } else if status == "cancelled" { + "该订单已被取消,如已扣款请联系客服处理" + } else { + "该订单状态异常,请联系客服" + }; + return Err(AppError::BadRequest(hint.to_string())); } // 一次性完成:更新订单状态 + 累加计算新的到期时间(纯 SQL) @@ -692,7 +699,7 @@ pub async fn confirm_payment_order_by_orderno( // 0 行 update 说明订单已被取消/退款/已确认(竞态保护生效) if result.rows_affected() == 0 { - tracing::warn!("支付确认: 订单 {} 状态已变更,跳过处理", order_no); + tracing::warn!("支付确认: 订单 {} 状态已变更,跳过处理(可能是竞态或重复回调)", order_no); return Ok(()); }