标记支付并生效:续费单必须绑定订阅(安全阀)并新增测试

This commit is contained in:
萝卜
2026-03-15 04:42:37 +00:00
parent c75e7ad7d6
commit c4c91ebf14
2 changed files with 73 additions and 0 deletions

View File

@@ -684,6 +684,11 @@ class PlatformOrderController extends Controller
{
$admin = $this->ensurePlatformAdmin($request);
// 治理优先:续费单必须绑定订阅(兼容历史脏数据/手工改库等场景)
if ((string) ($order->order_type ?? '') === 'renewal' && ! (int) ($order->site_subscription_id ?? 0)) {
return redirect()->back()->with('warning', '当前订单类型为「续费」但未绑定订阅site_subscription_id 为空)。为避免误同步/续期串单,请先补齐订阅关联后再处理。');
}
// 治理优先若该订单已有退款轨迹refund_summary/refund_receipts不允许直接“标记支付并生效”避免出现带退款的订单被强行推进并同步订阅
if ((float) $order->refundTotal() > 0) {
return redirect()->back()->with('warning', '当前订单已存在退款记录/退款汇总,请先核对退款轨迹与订单状态后再处理(不建议直接标记支付并生效)。');