|
|
|
|
@ -160,6 +160,7 @@ class OrderItems extends SoftDeletesModel
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Log::channel("daily_auto_checkout")->info("From " . $unpaid_order_items->first()->id . " to " . $unpaid_order_items->last()->id);
|
|
|
|
|
foreach ($unpaid_order_items as $item) {
|
|
|
|
|
$customer = $item->customer;
|
|
|
|
|
if ($customer->balance < $item->total || $item->total == 0) {
|
|
|
|
|
@ -179,9 +180,9 @@ class OrderItems extends SoftDeletesModel
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$customer->update(["balance" => $balance]);
|
|
|
|
|
Log::channel("daily_auto_checkout")->info($item->id . "扣款成功");
|
|
|
|
|
}
|
|
|
|
|
cache(['last_auto_checkout_order_item_id' => $unpaid_order_items->last()->id], now()->addSeconds(90));
|
|
|
|
|
Log::channel("daily_auto_checkout")->info("From " . $unpaid_order_items->first()->id . " to " . $unpaid_order_items->last()->id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function balance()
|
|
|
|
|
|