LogisticZopService.php 770 B

1234567891011121314151617181920212223242526272829303132
  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' => 1,
  19. 'billCode' => '75424921258500',
  20. ]);
  21. $request->setBody($body);
  22. return json_decode($client->execute($request));
  23. }
  24. }