DelayQueueJob.php 812 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Module\DelayQueue\Job;
  3. use App\Module\DelayQueue\Entity\Queue;
  4. use App\Module\DelayQueue\Redis;
  5. use UCore\Queue\QueueJob;
  6. class DelayQueueJob extends QueueJob
  7. {
  8. public function __construct(public Queue $arg)
  9. {
  10. }
  11. public function run(): bool
  12. {
  13. $key =Redis::getkey([$this->arg->runClass,$this->arg->runMethod],$this->arg->runParam);
  14. /**
  15. * @var \Redis $a
  16. */
  17. $a = \Illuminate\Support\Facades\Redis::client();
  18. $a->del($key);
  19. // dump($this->arg,[$this->arg->runClass,$this->arg->runMethod]);
  20. $res = call_user_func([$this->arg->runClass,$this->arg->runMethod],$this->arg->runParam);
  21. // dump($res);
  22. return true;
  23. }
  24. public function payload()
  25. {
  26. return $this->arg;
  27. }
  28. }