ActionTrigger.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Jobs;
  3. use Artisan;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Bus\Dispatchable;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Queue\SerializesModels;
  9. /**
  10. * 动作触发器,兼容所有扔队列需要异步处理的请求
  11. * @author zhoulingjie
  12. *
  13. */
  14. class ActionTrigger implements ShouldQueue
  15. {
  16. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  17. protected $data;
  18. /**
  19. * Create a new job instance.
  20. *
  21. * @return void
  22. */
  23. public function __construct($data)
  24. {
  25. //
  26. \Log::info('action_trigger_init');
  27. $this->data = $data;
  28. }
  29. /**
  30. * Execute the job.
  31. *
  32. * @return void
  33. */
  34. public function handle()
  35. {
  36. // $data = json_encode($this->data);
  37. // try {
  38. // \Log::info('ActionTrigger:'.$data['action_type'].' start');
  39. // Artisan::call('ActionTrigger:'.$data['action_type'],['data'=>$data]);
  40. // } catch (\Exception $e) {
  41. // \Log::info('action_trigger_ept:'.$e->getMessage());
  42. // }
  43. }
  44. }