JobServer.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace App\Servers;
  3. use App\Jobs\BoadcastDetectionJob;
  4. use App\Jobs\BusinessFileJob;
  5. use App\Jobs\ContractCommonJob;
  6. use App\Jobs\CreatBothJob;
  7. use App\Jobs\MsgFileJob;
  8. use App\Jobs\VerificationLevelJob;
  9. use App\Models\BlockItems;
  10. /**
  11. * Redis数据缓存类
  12. */
  13. class JobServer
  14. {
  15. static private $server = '';
  16. private function __construct()
  17. {
  18. }
  19. /**
  20. * 创建对象
  21. * @return JobServer
  22. */
  23. static function creatServer()
  24. {
  25. if (empty(self::$server)) {
  26. self::$server = new JobServer();
  27. }
  28. return self::$server;
  29. }
  30. /**
  31. * 任务图片处理
  32. * @param $blockItem
  33. * @return void
  34. */
  35. function broadcastDetectionJob(BlockItems $blockItem){
  36. BoadcastDetectionJob::dispatch($blockItem)->delay(3)->onConnection('redis')->onQueue('broadcastDetection');
  37. }
  38. /**
  39. * 双线关系绑定
  40. * @param $mId
  41. * @param $pId
  42. */
  43. function creatBothJob($mId,$pId){
  44. CreatBothJob::dispatch($mId,$pId)->delay(3)->onConnection('redis')->onQueue('creatBoth');
  45. }
  46. /**
  47. * 会员等级升级
  48. * @param $pIds
  49. */
  50. function verificationLevelJob($pIds){
  51. VerificationLevelJob::dispatch($pIds)->delay(3)->onConnection('redis')->onQueue('newLevel');
  52. }
  53. /**
  54. * 公排出局
  55. */
  56. function contractCommonJob(){
  57. ContractCommonJob::dispatch()->delay(3)->onConnection('redis')->onQueue('contractCommon');
  58. }
  59. }