diff --git a/app/Console/Commands/OrderProfitCommand.php b/app/Console/Commands/OrderProfitCommand.php index 5377afff..d9d6e0cd 100644 --- a/app/Console/Commands/OrderProfitCommand.php +++ b/app/Console/Commands/OrderProfitCommand.php @@ -80,8 +80,13 @@ class OrderProfitCommand extends Command // 没有待付款的提成记录 Order::where(fn($q) => $q->whereHas('profits', fn($q) => $q->where('status', 2))->orWhereDoesntHave('profits')) + // 订单已完成 + ->where('status', Order::STATUS_COMPLETED) + // 没有售后订单 + ->whereDoesntHave('afterSales') // 售后期过了 ->where('completed_at', '<', now()->subDays($saleDays)) + // 未支付提成 ->whereNull('profit_paid') ->update(['profit_paid' => now()]);