统一对账差额阈值使用 amounts.tolerance 配置

This commit is contained in:
萝卜
2026-03-13 11:25:31 +00:00
parent 916796f58e
commit ffbf68679b
3 changed files with 15 additions and 2 deletions

View File

@@ -69,7 +69,12 @@ class PlatformOrder extends Model
$receiptCents = (int) round(((float) $this->receiptTotal()) * 100);
$paidCents = (int) round(((float) ($this->paid_amount ?? 0)) * 100);
return abs($receiptCents - $paidCents) >= 1;
$tol = (float) config('saasshop.amounts.tolerance', 0.01);
$tolCents = (int) round($tol * 100);
// 以“分”为最小粒度,至少 1 分(若配置 0则视为要求严格一致
$tolCents = max(1, $tolCents);
return abs($receiptCents - $paidCents) >= $tolCents;
}
protected $fillable = [