| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace App\Console\Commands;
- use Illuminate\Console\Command;
- use App\Models\Sport as SportModel;
- use App\Services\SportClientService;
- use Carbon\Carbon;
- use Illuminate\Support\Facades\DB;
- use App\Models\SportEvent;
- use App\Models\Config;
- class Sport extends Command
- {
- /**
- * 命令名称和签名
- *
- * @var string
- */
- protected $signature = 'sport {is_live=0}';
- protected $is_live = 0;
- protected $short_status = [
- 'TBD' => 0,
- 'NS' => 0,
- '1H' => 1,
- 'HT' => 1,
- '2H' => 1,
- 'ET' => 1,
- 'BT' => 1,
- 'P' => 1,
- 'SUSP' => 1,
- 'INT' => 1,
- 'FT' => 2,
- 'AET' => 2,
- 'PEN' => 2,
- 'PST' => 3,
- 'CANC' => 4,
- 'ABD' => 4,
- 'AWD' => 4,
- 'WO' => 4,
- 'LIVE' => 1,
- ];
- protected $long_status = [
- 'Time To Be Defined' => 0,
- 'Not Started' => 0,
- 'First Half' => 1,
- 'First Half, Kick Off' => 1,
- 'Halftime' => 1,
- 'Second Half' => 1,
- 'Second Half, 2nd Half Started' => 1,
- 'Extra Time' => 1,
- 'Break Time' => 1,
- 'Penalty In Progress' => 1,
- 'Match Suspended' => 1,
- 'Match Interrupted' => 1,
- 'Match Finished' => 2,
- 'Match Finished' => 2,
- 'Match Finished' => 2,
- 'Match Postponed' => 3,
- 'Match Cancelled' => 4,
- 'Match Abandoned' => 4,
- 'Technical Loss' => 4,
- 'WalkOver' => 4,
- 'In Progress' => 1,
- ];
-
- protected $fixture_status = [
- 'First Half' => 1,
- 'First Half, Kick Off' => 1,
- 'Halftime' => 1,
- 'Second Half' => 1,
- 'Second Half, 2nd Half Started' => 1,
- 'Extra Time' => 1,
- 'Break Time' => 1,
- 'Penalty In Progress' => 1,
- ];
-
- /**
- * 命令描述
- *
- * @var string
- */
- protected $description = '当天会去更新明天的赛事(23:59:00执行一次)';
- /**
- * 执行命令
- *
- * @return int
- */
- public function handle()
- {
- $data = SportClientService::leagues(['season' => date('Y')]);
- file_put_contents("leagues.json", json_encode($data));
- }
- }
|