|
|
@@ -48,17 +48,17 @@ class OrderClearClass extends BaseClass
|
|
|
return true;
|
|
|
}
|
|
|
$totalAmount = 0;
|
|
|
- $totalMoney = 0;
|
|
|
$need = [];
|
|
|
foreach ($orderList as $order) {
|
|
|
$orderId = $order->id ?? 0;
|
|
|
$remainDebtPrice = $order->remainDebtPrice ?? 0;
|
|
|
- $totalMoney = bcadd($totalMoney, $remainDebtPrice, 2);
|
|
|
- if ($totalMoney > $customBalance) {
|
|
|
- break;
|
|
|
+ $currentTotal = bcadd($totalAmount, $remainDebtPrice, 2);
|
|
|
+ if ($currentTotal > $customBalance) {
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ $totalAmount = bcadd($totalAmount, $remainDebtPrice, 2);
|
|
|
+ $need[] = ['id' => $orderId];
|
|
|
}
|
|
|
- $totalAmount = bcadd($totalAmount, $remainDebtPrice, 2);
|
|
|
- $need[] = ['id' => $orderId];
|
|
|
}
|
|
|
if (empty($need)) {
|
|
|
return true;
|