| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?phpnamespace App\Jobs;use App\Service\CloudDataService;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;use Symfony\Component\Console\Output\ConsoleOutput;use Symfony\Component\Console\Output\OutputInterface;class CloudDataJob implements ShouldQueue{    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;    protected $data;    /**     * Create a new job instance.     *     * @return void     */    public function __construct($data)    {        $this->data = $data;    }    /**     * Execute the job.     *     * @return void     */    public function handle()    {        $this->settle();        //输出信息 测试        $this->echoMessage(new ConsoleOutput());    }    private function settle(){        $service = new CloudDataService();        $service->cloudData();    }    protected function echoMessage(OutputInterface $output)    {        $output->writeln($this->data);    }}
 |