123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace App\Console\Commands\Pair;
- use App\Models\Fpdx\ActivityModel;
- use App\Services\Pair\PairFirstMatch;
- use Illuminate\Console\Command;
- class PairMatchCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'pair:match {task=first} {stage_id?}';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '分配对象活动匹配';
- /** @var int 需要匹配的活动ID */
- protected $stageId;
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return void
- */
- public function handle()
- {
- $stageId = $this->argument('stage_id');
- if ($stageId) {
- $this->stageId = $stageId;
- } else {
- if (
- !$activity = ActivityModel::currently()->first()
- ) {
- $this->error("没有找到该期");
- return;
- }
- $this->stageId = $stageId;
- }
- $task = $this->argument('task');
- if (method_exists($this, $task)) {
- $this->{$task}();
- } else {
- $this->error("没有找到该函数");
- return;
- }
- }
- public function preview()
- {
- }
- public function first()
- {
- $pairFirstMatch = new PairFirstMatch($this->stageId);
- $pairFirstMatch->run();
- dump($pairFirstMatch->matchResult);
- }
- public function reMatch()
- {
- }
- }
|