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.
|
|
|
|
|
<?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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|