| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Services;
- use App\library\zop\ZopClient;
- use App\library\zop\ZopProperties;
- use App\library\zop\ZopRequest;
- class LogisticZopService
- {
- public function get(array $logisticNums)
- {
- $url = config('api_logistic.ZTO.url');
- $xAppKey = config('api_logistic.ZTO.x-appKey');
- $appSecret = config('api_logistic.ZTO.appSecret');
- $properties = new ZopProperties($xAppKey, $appSecret);
- $client = new ZopClient($properties);
- $request = new ZopRequest();
- $request->setUrl($url);
- $body = json_encode([
- 'type' => 1,
- 'billCode' => '75424921258500',
- ]);
- $request->setBody($body);
- return json_decode($client->execute($request));
- }
- public function tt(array $logisticNums)
- {
- $url = 'https://japi.zto.com/zto.open.obtainPicePrescription"';
- $xAppKey = config('api_logistic.ZTO.x-appKey');
- $xDataDigest = config('api_logistic.ZTO.appSecret');
- $properties = new ZopProperties($xAppKey, $xDataDigest);
- $client = new ZopClient($properties);
- $request = new ZopRequest();
- $request->setUrl($url);
- $body = json_encode([
- 'type' => 1,
- 'billCode' => '75424921258500',
- ]);
- $request->setBody("{\"transportType\":0,\"sender\":{\"address\":\"华志路1685号\",\"province\":\"上海\",\"city\":\"上海市\",\"district\":\"青浦区\"},\"addresser\":{\"district\":\"青浦区\",\"address\":\"华志路1685号\",\"province\":\"上海\",\"city\":\"上海市\"},\"weight\":1}");
- return json_decode($client->execute($request));
- }
- }
|