feat: add PlatformOrder isReconcileMismatch and reuse in subscription summary

This commit is contained in:
萝卜
2026-03-11 06:57:25 +00:00
parent 5597a16ccc
commit a1ae7caf88
3 changed files with 110 additions and 4 deletions

View File

@@ -63,6 +63,15 @@ class PlatformOrder extends Model
return $paidCents > 0 && $refundCents >= $paidCents;
}
public function isReconcileMismatch(): bool
{
// 口径与平台订单列表 reconcile_mismatch 保持一致:支付回执总额 与订单 paid_amount 不一致(按分取整,差额>=0.01
$receiptCents = (int) round(((float) $this->receiptTotal()) * 100);
$paidCents = (int) round(((float) ($this->paid_amount ?? 0)) * 100);
return abs($receiptCents - $paidCents) >= 1;
}
protected $fillable = [
'merchant_id', 'plan_id', 'site_subscription_id', 'created_by_admin_id', 'order_no', 'order_type', 'status',
'payment_status', 'payment_channel', 'plan_name', 'billing_cycle', 'period_months', 'quantity', 'list_amount',