Leagues.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Models\Sport as SportModel;
  5. use App\Services\SportClientService;
  6. use Carbon\Carbon;
  7. use Illuminate\Support\Facades\DB;
  8. use App\Models\SportEvent;
  9. use App\Models\Config;
  10. class Sport extends Command
  11. {
  12. /**
  13. * 命令名称和签名
  14. *
  15. * @var string
  16. */
  17. protected $signature = 'sport {is_live=0}';
  18. protected $is_live = 0;
  19. protected $short_status = [
  20. 'TBD' => 0,
  21. 'NS' => 0,
  22. '1H' => 1,
  23. 'HT' => 1,
  24. '2H' => 1,
  25. 'ET' => 1,
  26. 'BT' => 1,
  27. 'P' => 1,
  28. 'SUSP' => 1,
  29. 'INT' => 1,
  30. 'FT' => 2,
  31. 'AET' => 2,
  32. 'PEN' => 2,
  33. 'PST' => 3,
  34. 'CANC' => 4,
  35. 'ABD' => 4,
  36. 'AWD' => 4,
  37. 'WO' => 4,
  38. 'LIVE' => 1,
  39. ];
  40. protected $long_status = [
  41. 'Time To Be Defined' => 0,
  42. 'Not Started' => 0,
  43. 'First Half' => 1,
  44. 'First Half, Kick Off' => 1,
  45. 'Halftime' => 1,
  46. 'Second Half' => 1,
  47. 'Second Half, 2nd Half Started' => 1,
  48. 'Extra Time' => 1,
  49. 'Break Time' => 1,
  50. 'Penalty In Progress' => 1,
  51. 'Match Suspended' => 1,
  52. 'Match Interrupted' => 1,
  53. 'Match Finished' => 2,
  54. 'Match Finished' => 2,
  55. 'Match Finished' => 2,
  56. 'Match Postponed' => 3,
  57. 'Match Cancelled' => 4,
  58. 'Match Abandoned' => 4,
  59. 'Technical Loss' => 4,
  60. 'WalkOver' => 4,
  61. 'In Progress' => 1,
  62. ];
  63. protected $fixture_status = [
  64. 'First Half' => 1,
  65. 'First Half, Kick Off' => 1,
  66. 'Halftime' => 1,
  67. 'Second Half' => 1,
  68. 'Second Half, 2nd Half Started' => 1,
  69. 'Extra Time' => 1,
  70. 'Break Time' => 1,
  71. 'Penalty In Progress' => 1,
  72. ];
  73. /**
  74. * 命令描述
  75. *
  76. * @var string
  77. */
  78. protected $description = '当天会去更新明天的赛事(23:59:00执行一次)';
  79. /**
  80. * 执行命令
  81. *
  82. * @return int
  83. */
  84. public function handle()
  85. {
  86. $data = SportClientService::leagues(['season' => date('Y')]);
  87. file_put_contents("leagues.json", json_encode($data));
  88. }
  89. }