/**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        try {
            //执行代码
            (new LazadaTransactionsExportQueueJobLogic())->run($this->batchId);
        } catch (\Exception $exception) {
            $this->failed($exception);
        };
    }

    /**
     * 任务失败的处理过程
     *
     * @param Exception $exception
     * @return void
     */
    public function failed(\Exception $exception)
    {
        $logFile = fopen(
            storage_path('logs' . DIRECTORY_SEPARATOR . date('Y-m-d') . '_lazada_transactions_export_queue.log'),
            'a+'
        );
        fwrite($logFile, date('Y-m-d H:i:s') . ': ' . $exception->getMessage() . PHP_EOL);
        fclose($logFile);
    }

 

相关文章:

  • 2021-08-05
  • 2021-10-15
  • 2022-02-03
  • 2021-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-11-21
  • 2021-08-18
猜你喜欢
  • 2022-02-03
  • 2021-11-26
  • 2021-11-10
  • 2021-05-24
  • 2021-11-25
  • 2021-12-28
  • 2021-08-13
相关资源
相似解决方案