ModifySubPlatformJob.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\Jobs;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Queue\SerializesModels;
  5. use Illuminate\Queue\InteractsWithQueue;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Ixudra\Curl\Facades\Curl;
  8. class ModifySubPlatformJob implements ShouldQueue
  9. {
  10. use InteractsWithQueue, Queueable, SerializesModels;
  11. protected $platform;
  12. protected $data;
  13. /**
  14. * Create a new job instance.
  15. *
  16. * @return void
  17. */
  18. public function __construct($tripartite_provider,$datas)
  19. {
  20. //子平台信息修改
  21. $this->platform = $tripartite_provider;
  22. $this->data = $datas;
  23. }
  24. /**
  25. * Execute the job.
  26. *
  27. * @return void
  28. */
  29. public function handle()
  30. {
  31. foreach ($this->platform as $item){
  32. \Log::debug('进入handle',$item);
  33. \Log::debug('打印',[$item['domain'],$item['platform_uniacid']]);
  34. $url = "{$item['domain']}/addons/yun_shop/api.php?i={$item['platform_uniacid']}&mid=0&type=5&shop_id=null&route=plugin.provider-platform.api.tripartiteProviderWithdrawal.SubplatformInfo.store";
  35. \Log::debug('进入$url',$url);
  36. // 提交推送请求
  37. $response = Curl::to($url)->withData(['data' => json_encode($this->data,1)])->asJsonResponse(true)->post();
  38. if ($response['result'] != 1) {
  39. \Log::debug('域名为'.$item['domain'].'公众ID为'.$item['platform_uniacid'].'的平台的域名或公众号ID有误');
  40. }
  41. }
  42. }
  43. }