RejectedBillCreateInstantBill.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Jobs;
  3. use App\RejectedBill;
  4. use App\Services\LogService;
  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. class RejectedBillCreateInstantBill implements ShouldQueue
  11. {
  12. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  13. protected $rejected;
  14. /**
  15. * Create a new job instance.
  16. *
  17. * @return void
  18. *
  19. * @param RejectedBill $rejectedBill
  20. */
  21. public function __construct(RejectedBill $rejectedBill)
  22. {
  23. $this->rejected = $rejectedBill;
  24. }
  25. /**
  26. * Execute the job.
  27. *
  28. * @return void
  29. * @throws
  30. */
  31. public function handle()
  32. {
  33. try{
  34. app("RejectedBillService")->buildInstantBill($this->rejected);
  35. }catch(\Exception $exception){
  36. LogService::log(__CLASS__,"退货单建立即时账单",$exception->getMessage()." | ".json_encode($this->rejected));
  37. throw new \Exception($e->getMessage());
  38. }
  39. }
  40. }