admin: 单笔标记支付并生效回执差额安全阀按容差配置化对齐

This commit is contained in:
萝卜
2026-03-13 15:14:25 +00:00
parent 9f22314c2a
commit 0745d5657c
3 changed files with 82 additions and 2 deletions

View File

@@ -463,7 +463,12 @@ class PlatformOrderController extends Controller
$expectedPaid = (float) (($order->paid_amount ?? 0) > 0 ? $order->paid_amount : $order->payable_amount);
$receiptCents = (int) round($receiptTotal * 100);
$expectedCents = (int) round($expectedPaid * 100);
if ($receiptCents > 0 && abs($receiptCents - $expectedCents) >= 1) {
$tol = (float) config('saasshop.amounts.tolerance', 0.01);
$tolCents = (int) round($tol * 100);
$tolCents = max(1, $tolCents);
if ($receiptCents > 0 && abs($receiptCents - $expectedCents) >= $tolCents) {
return redirect()->back()->with('warning', '当前订单已存在支付回执,但回执总额与订单金额不一致。为避免带病推进,请先补齐/修正支付回执后再执行「标记支付并生效」。');
}