Leagues.php 638 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Services\SportClientService;
  5. class Leagues extends Command
  6. {
  7. /**
  8. * 命令名称和签名
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'leagues';
  13. protected $is_live = 0;
  14. /**
  15. * 命令描述
  16. *
  17. * @var string
  18. */
  19. protected $description = '获取所有联赛信息';
  20. /**
  21. * 执行命令
  22. *
  23. * @return int
  24. */
  25. public function handle()
  26. {
  27. $data = SportClientService::leagues(['season' => date('Y')]);
  28. file_put_contents("leagues.json", json_encode($data));
  29. }
  30. }