增加 删除所有未付款并且大于两天的订单

This commit is contained in:
iVampireSP.com 2022-09-18 14:34:54 +08:00
parent d48a665dc4
commit 74ea16ed29
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -28,8 +28,6 @@ public function handle()
$bc = new BalanceController();
// 查找今天未支付的订单
Balance::where('paid_at', null)->chunk(100, function ($balances) use ($bc) {
foreach ($balances as $balance) {
if (!$bc->checkAndCharge($balance)) {
@ -40,6 +38,9 @@ public function handle()
}
});
// 删除所有未付款并且大于两天的订单
Balance::where('paid_at', null)->where('created_at', '<', now()->subDays(2))->delete();
// Balance::chunk(100, function ($balances) use ($bc) {
// foreach ($balances as $balance) {