WaybillCreateInstantBill.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Jobs;
  3. use App\Services\LogService;
  4. use App\Services\WaybillService;
  5. use App\Waybill;
  6. use Illuminate\Bus\Queueable;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. use Illuminate\Foundation\Bus\Dispatchable;
  9. use Illuminate\Queue\InteractsWithQueue;
  10. use Illuminate\Queue\SerializesModels;
  11. /**
  12. * @Deprecated 物流单生成即时账单
  13. */
  14. class WaybillCreateInstantBill implements ShouldQueue
  15. {
  16. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  17. protected $waybill;
  18. /**
  19. * Create a new job instance.
  20. *
  21. * @param Waybill $waybill
  22. * @return void
  23. */
  24. public function __construct(Waybill $waybill)
  25. {
  26. $this->waybill = $waybill;
  27. }
  28. /**
  29. * Execute the job.
  30. *
  31. * @param WaybillService $service
  32. * @return void
  33. * @throws
  34. */
  35. public function handle(WaybillService $service)
  36. {
  37. try{
  38. $service->createInstantBill($this->waybill);
  39. }catch (\Exception $e){
  40. LogService::log(__METHOD__,"ERROR-运输计算运费失败",$this->waybill->toJson()." | ".$e->getMessage());
  41. throw new \Exception($e->getMessage());
  42. }
  43. }
  44. }