| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Jobs;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Support\Facades\Http;
- use Illuminate\Support\Facades\Log;
- class RejectedPushJob implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- public $tries = 5;
- public $timeout = 120;
- /**
- * type: 推单,上架
- * [
- * ['sku' => '75603675975072','taskNum' => 'JI20220316211', 'asnNo' => 'asn002', 'type' => '推单'],
- * ['sku' => '75603675975072','taskNum' => 'JI20220316211', 'asnNo' => 'asn002', 'type' => '推单'],
- * ]
- */
- private $pushData;
- /**
- * @param array $pushData
- */
- public function __construct(array $pushData)
- {
- $this->pushData = $pushData;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $data = [];
- foreach ($this->pushData as $item) {
- $data[] = [
- 'asnNo' => $item[0],
- 'logisticNumberReturn' => $item[1],
- 'type' => '推单',
- ];
- }
- $url = config('api.java.wms.rejectedPushTask.receivePush');
- $response = Http::post($url, $data);
- Log::info("推送信息!", ['res' => $response->body(), 'req' => $data]);
- }
- }
|