<?php

namespace App\Jobs;

use Artisan;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

/**
 * 动作触发器，兼容所有扔队列需要异步处理的请求
 * @author zhoulingjie
 *
 */
class ActionTrigger implements ShouldQueue
{
    use Dispatchable, 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 =  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());
//         }
    }
}
