RejectedPushJob.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Jobs;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Foundation\Bus\Dispatchable;
  6. use Illuminate\Queue\InteractsWithQueue;
  7. use Illuminate\Queue\SerializesModels;
  8. use Illuminate\Support\Facades\Http;
  9. use Illuminate\Support\Facades\Log;
  10. class RejectedPushJob implements ShouldQueue
  11. {
  12. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  13. public $tries = 5;
  14. public $timeout = 120;
  15. /**
  16. * type: 推单,上架
  17. * [
  18. * ['sku' => '75603675975072','taskNum' => 'JI20220316211', 'asnNo' => 'asn002', 'type' => '推单'],
  19. * ['sku' => '75603675975072','taskNum' => 'JI20220316211', 'asnNo' => 'asn002', 'type' => '推单'],
  20. * ]
  21. */
  22. private $pushData;
  23. /**
  24. * @param array $pushData
  25. */
  26. public function __construct(array $pushData)
  27. {
  28. $this->pushData = $pushData;
  29. }
  30. /**
  31. * Execute the job.
  32. *
  33. * @return void
  34. */
  35. public function handle()
  36. {
  37. $url = config('api.java.wms.rejectedPushTask.receivePush');
  38. $response = Http::post($url, $this->pushData);
  39. Log::info("推送信息!", ['res' => $response->body(), 'req' => $this->pushData]);
  40. }
  41. }