From 522b1b06f4f118b7b9e9989a3b9f39d964fee7c4 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Thu, 4 Aug 2022 14:39:14 +0800 Subject: [PATCH] order:profit update profit_paid --- app/Console/Commands/OrderProfitCommand.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/OrderProfitCommand.php b/app/Console/Commands/OrderProfitCommand.php index 53d8301b..5377afff 100644 --- a/app/Console/Commands/OrderProfitCommand.php +++ b/app/Console/Commands/OrderProfitCommand.php @@ -42,6 +42,7 @@ class OrderProfitCommand extends Command */ public function handle() { + $service = new DistributeService(); // 售后过期天数 7 @@ -78,9 +79,11 @@ class OrderProfitCommand extends Command } // 没有待付款的提成记录 - // if (!$order->profits()->where('status', 0)->exists()) { - // $order->update(['profit_paid' => now()]); - // } + Order::where(fn($q) => $q->whereHas('profits', fn($q) => $q->where('status', 2))->orWhereDoesntHave('profits')) + // 售后期过了 + ->where('completed_at', '<', now()->subDays($saleDays)) + ->whereNull('profit_paid') + ->update(['profit_paid' => now()]); $page++;