12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Jobs;
- use App\Jobs\Job;
- use Artisan;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\DispatchesJobs;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- /**
- * 动作触发器,兼容所有扔队列需要异步处理的请求
- * @author zhoulingjie
- *
- */
- class ActionTrigger implements ShouldQueue
- {
- use DispatchesJobs, InteractsWithQueue, Queueable, SerializesModels;
- protected $data;
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct($data)
- {
- //
- \Log::info('action_trigger_init');
- $this->data = $data;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $data = $this->data;
- $data = isset($data['data'])?$data['data']:null;
- \Log::info('ActionTrigger_start');\Log::info($data);
- echo json_encode($this->data);
- try {
- \Log::info('ActionTrigger:'.$data['action_type'].' start');
- Artisan::call('ActionTrigger:'.$data['action_type'],['data'=>$data]);
- } catch (\Exception $e) {
- \Log::info('action_trigger_ept:'.$e->getMessage());
- }
- }
- }
|