LabelDealJob.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Jobs;
  3. use App\Service\DwyService;
  4. use App\Service\LabelDealService;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Queue\InteractsWithQueue;
  9. use Illuminate\Queue\SerializesModels;
  10. use Symfony\Component\Console\Output\ConsoleOutput;
  11. use Symfony\Component\Console\Output\OutputInterface;
  12. class LabelDealJob implements ShouldQueue
  13. {
  14. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  15. protected $data;
  16. protected $header;
  17. protected $id;
  18. /**
  19. * Create a new job instance.
  20. *
  21. * @return void
  22. */
  23. public function __construct($data,$header,$id)
  24. {
  25. $this->data = $data;
  26. $this->header = $header;
  27. $this->id = $id;
  28. }
  29. /**
  30. * Execute the job.
  31. *
  32. * @return void
  33. */
  34. public function handle()
  35. {
  36. $data = $this->data;
  37. $dv = $data['key'];
  38. $return = $box_list = [];
  39. //处理数据
  40. LabelDealService::getInstance()->clearData($data,$return,$box_list);
  41. //调用外部方法
  42. list($lead_bind,$lead_out) = DwyService::getInstance()->setBoxData($this->header,$dv,$return,$box_list,$data);
  43. //调用保存接口
  44. LabelDealService::getInstance()->boxOut($lead_bind,$lead_out,$this->header,$this->id);
  45. }
  46. protected function echoMessage(OutputInterface $output)
  47. {
  48. $output->writeln($this->data);
  49. }
  50. }