LogisticZopService.php 819 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Services;
  3. use App\library\zop\ZopClient;
  4. use App\library\zop\ZopProperties;
  5. use App\library\zop\ZopRequest;
  6. class LogisticZopService
  7. {
  8. public function get(array $logisticNums)
  9. {
  10. $url = config('api_logistic.ZTO.url');
  11. $xAppKey = config('api_logistic.ZTO.x-appKey');
  12. $xDataDigest = config('api_logistic.ZTO.x-dataDigest');
  13. $properties = new ZopProperties($xAppKey, $xDataDigest);
  14. $client = new ZopClient($properties);
  15. $request = new ZopRequest();
  16. $request->setUrl($url);
  17. $body = json_encode([
  18. 'type' => 0,
  19. 'orderCode' => '200824000005397109',
  20. 'billCode' => '73110263178916',
  21. ]);
  22. $request->setBody($body);
  23. return json_decode($client->execute($request));
  24. }
  25. }