统一对账差额阈值使用 amounts.tolerance 配置
This commit is contained in:
@@ -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 = [
|
||||
|
||||
Reference in New Issue
Block a user