| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | 
							- <?php
 
- namespace App\Jobs;
 
- use App\Service\DwyService;
 
- use App\Service\LabelDealService;
 
- 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 LabelDealJob implements ShouldQueue
 
- {
 
-     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
-     protected $data;
 
-     protected $header;
 
-     protected $id;
 
-     /**
 
-      * Create a new job instance.
 
-      *
 
-      * @return void
 
-      */
 
-     public function __construct($data,$header,$id)
 
-     {
 
-         $this->data = $data;
 
-         $this->header = $header;
 
-         $this->id = $id;
 
-     }
 
-     public function handle()
 
-     {
 
-         try {
 
-             $data = $this->data;
 
-             $dv = $data['key'];
 
-             $return = $box_list = [];
 
-             //处理数据
 
-             LabelDealService::getInstance()->clearData($data,$return,$box_list);
 
-             file_put_contents('msg_result.txt',date('Y-m-d H:i:s') . "清洗数据:" . json_encode($return) . PHP_EOL,8);
 
-             //调用外部方法
 
-             list($lead_bind,$lead_out) = DwyService::getInstance()->setBoxData($this->header,$dv,$return,$box_list,$data);
 
-             //调用保存接口
 
-             LabelDealService::getInstance()->boxOut($lead_bind,$lead_out,$this->header,$this->id);
 
-         }catch (\Throwable $exception){
 
-             file_put_contents('msg_result.txt',date('Y-m-d H:i:s') . "队列捕获:" . $exception->getLine() . "|" . $exception->getMessage(). "|"  . $exception->getCode(). PHP_EOL,8);
 
-             $this->delete();
 
-         }
 
-     }
 
-     protected function echoMessage(OutputInterface $output)
 
-     {
 
-         $output->writeln($this->data);
 
-     }
 
- }
 
 
  |