GatewayJob.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Jobs;
  3. use GatewayWorker\Lib\Gateway;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldBeUnique;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Queue\InteractsWithQueue;
  9. use Illuminate\Queue\SerializesModels;
  10. class GatewayJob implements ShouldQueue
  11. {
  12. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  13. protected $client_id = '';
  14. protected $msg = '';
  15. /**
  16. * Create a new job instance.
  17. *
  18. * @return void
  19. */
  20. public function __construct($client_id, $msg)
  21. {
  22. $this->client_id = $client_id;
  23. $this->msg = $msg;
  24. }
  25. /**
  26. * Execute the job.
  27. *
  28. * @return void
  29. */
  30. public function handle()
  31. {
  32. if(_empty_($this->client_id)){
  33. return;
  34. }
  35. // if($this->client_id == 'all'){
  36. Gateway::sendToAll($this->msg);
  37. // }else{
  38. // Gateway::sendToClient($this->client_id, $this->msg);
  39. // }
  40. }
  41. }