You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
825 B

4 days ago
<?php
namespace App\Console\Commands;
use App\Models\TicketGrabEvent;
use App\Services\TicketGrabReleaseDayService;
use Illuminate\Console\Command;
class TicketGrabSyncCarryCommand extends Command
{
protected $signature = 'ticket-grab:sync-carry {--event= : 仅指定抢票活动 ID}';
protected $description = '按放票日顺序重算各日 carry_in结转';
public function handle(): int
{
$id = $this->option('event');
if ($id) {
TicketGrabReleaseDayService::syncCarryInChain((int) $id);
return self::SUCCESS;
}
TicketGrabEvent::query()->orderBy('id')->pluck('id')->each(function (int $eid) {
TicketGrabReleaseDayService::syncCarryInChain($eid);
});
$this->info('done');
return self::SUCCESS;
}
}