JobServer.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Servers;
  3. use App\Jobs\BoadcastDetectionJob;
  4. use App\Jobs\BusinessFileJob;
  5. use App\Jobs\CreatBothJob;
  6. use App\Jobs\MsgFileJob;
  7. use App\Models\BlockItems;
  8. /**
  9. * Redis数据缓存类
  10. */
  11. class JobServer
  12. {
  13. static private $server = '';
  14. private function __construct()
  15. {
  16. }
  17. /**
  18. * 创建对象
  19. * @return JobServer
  20. */
  21. static function creatServer()
  22. {
  23. if (empty(self::$server)) {
  24. self::$server = new JobServer();
  25. }
  26. return self::$server;
  27. }
  28. /**
  29. * 任务图片处理
  30. * @param $blockItem
  31. * @return void
  32. */
  33. function broadcastDetectionJob(BlockItems $blockItem){
  34. BoadcastDetectionJob::dispatch($blockItem)->delay(3)->onConnection('redis')->onQueue('broadcastDetection');
  35. }
  36. /**
  37. * 双线关系绑定
  38. * @param $mId
  39. * @param $pId
  40. */
  41. function creatBothJob($mId,$pId){
  42. CreatBothJob::dispatch($mId,$pId)->delay(3)->onConnection('redis')->onQueue('creatBoth');
  43. }
  44. }