Skip to content

Commit

Permalink
Merge pull request #25 from icowan/master
Browse files Browse the repository at this point in the history
修复了一些提交报错的问题
  • Loading branch information
forecho authored Sep 24, 2020
2 parents 8f37573 + 492ede1 commit 2258098
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $config = [
'eccang' => [
"appKey" => "",
"appToken" => "",
"wsdl" => ""
"host" => ""
]
],
];
Expand Down
24 changes: 12 additions & 12 deletions src/platforms/EccangPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class EccangPlatform extends Platform
];

/**
* @return Client|nusoap_client
* @return Client
*/
public function getClient()
{
$this->endpoint = $this->config->get("wsdl") ?: $this->webService;
$this->endpoint = $this->config->get("host") ?: $this->webService;
$this->appKey = $this->config->get("appKey");
$this->appToken = $this->config->get("appToken");
// return new \SoapClient($this->wsdl, $this->options);
Expand All @@ -77,7 +77,7 @@ public function getTransportsByCountryCode(string $countryCode)
$req = $this->getRequestParams(
'getCountry', []
);
$rs = $this->client->post($this->webService, [
$rs = $this->client->post($this->endpoint, [
"body" => $req,
]);
$result = $this->parseResponse($rs->getBody());
Expand Down Expand Up @@ -110,7 +110,7 @@ public function createOrder(Order $order): OrderResult
$this->formatOrder($order)
);

$rs = $this->client->post($this->webService, [
$rs = $this->client->post($this->endpoint, [
"body" => $req,
]);
$result = $this->parseResponse($rs->getBody());
Expand Down Expand Up @@ -139,7 +139,7 @@ public function getPrintUrl(string $orderNumber): string
"label_type" => "2",
]
);
$rs = $this->client->post($this->webService, [
$rs = $this->client->post($this->endpoint, [
"body" => $req,
]);

Expand All @@ -160,7 +160,7 @@ public function getOrderFee(string $orderNumber): OrderFee
"reference_no" => $orderNumber,
]
);
$rs = $this->client->post($this->webService, [
$rs = $this->client->post($this->endpoint, [
"body" => $req,
]);
$result = $this->parseResponse($rs->getBody());
Expand Down Expand Up @@ -226,7 +226,7 @@ protected function formatOrder(Order $orderClass): array
"invoice_cnname" => $good->cnDescription,
"invoice_enname" => $good->enMaterial,
"invoice_weight" => $good->weight,
"invoice_quantity" => $good->quantity,
"invoice_quantity" => $good->quantity < 1 ? 1 : intval($good->quantity),
"invoice_unitcharge" => $good->worth,
"hs_code" => $good->hsCode,
"sku" => $good->sku
Expand All @@ -245,7 +245,7 @@ protected function formatOrder(Order $orderClass): array
"shipping_method" => $orderClass->transportCode,
"country_code" => $orderClass->shipper->countryCode,
"order_weight" => $orderClass->package->weight,
"order_pieces" => $orderClass->package->declareWorth,
"order_pieces" => intval($orderClass->package->declareWorth),
"is_return" => $orderClass->isReturn,
// "reference_id" => "461983",
// "shipment_id" => "1235646",
Expand All @@ -265,16 +265,16 @@ protected function formatOrder(Order $orderClass): array
private function getTrackNumber(string $referenceNo): array
{
$req = $this->getRequestParams(
'getLabelUrl',
'getTrackNumber',
[
"reference_no" => $referenceNo,
"reference_no" => [$referenceNo],
]
);
$rs = $this->client->post($this->webService, [
$rs = $this->client->post($this->endpoint, [
"body" => $req,
]);
$result = $this->parseResponse($rs->getBody());
if (count($result["data"]) < 1) {
if (empty($result["data"])) {
return [];
}
return $result["data"][0];
Expand Down

0 comments on commit 2258098

Please sign in to comment.