AddShiftVideoJob.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://doc.hyperf.io
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
  10. */
  11. namespace App\Jobs;
  12. use App\Repositories\ConfigRepoistory;
  13. use App\Repositories\Service\CommonService;
  14. use Hyperf\AsyncQueue\Job;
  15. class AddShiftVideoJob extends Job
  16. {
  17. public $params;
  18. public function __construct($params)
  19. {
  20. // 这里最好是普通数据,不要使用携带 IO 的对象,比如 PDO 对象
  21. $this->params = $params;
  22. }
  23. public function handle()
  24. {
  25. try {
  26. $shift_url = make(ConfigRepoistory::class)->get('shift_url', 'sys');
  27. logger('AddShiftVideoJob', ['url'=>$shift_url, $this->params]);
  28. $result = make(CommonService::class)->httpPostJson($shift_url, $this->params);
  29. logger('AddShiftVideoJob', \GuzzleHttp\json_decode($result, true));
  30. } catch (\Exception $exception) {
  31. logger('AddShiftVideoJob', [$exception->getMessage()]);
  32. }
  33. }
  34. }