|
|
@@ -47,15 +47,9 @@ class Logistics
|
|
|
|
|
|
function __construct()
|
|
|
{
|
|
|
- // if (!\Yii::$app->redis->get(self::wstLogisticsBearerTokenKey)) {
|
|
|
+ if (!\Yii::$app->redis->get(self::wstLogisticsBearerTokenKey)) {
|
|
|
$this->getAuthentication();
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
- function getDomain()
|
|
|
- {
|
|
|
- $env = 'prod';
|
|
|
- return $env === 'prod' ? self::prodDomain : self::testDomain;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -101,8 +95,6 @@ class Logistics
|
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
|
$response = curl_exec($ch);
|
|
|
|
|
|
- LoggerTool::info(['Authentication', $request, $response, Yii::$app->params['wst']['baseToken']]);
|
|
|
-
|
|
|
curl_close($ch);
|
|
|
|
|
|
$result = json_decode($response, true);
|
|
|
@@ -118,17 +110,17 @@ class Logistics
|
|
|
{
|
|
|
$request = [
|
|
|
'order_no' => $order['SN'], // 客户系统中的订单号
|
|
|
- 'delivery_method_id' => '60', // 快递方式ID. TODO: 133(test)
|
|
|
- 'warehouse_id' => '1', // 仓库ID. TODO:
|
|
|
- 'country' => 'China', // 收件人国家 Malaysia
|
|
|
- 'state' => Region::getCnName($order['PROVINCE']), // , // 收件人省 Johor(test)
|
|
|
- 'city' => Region::getCnName($order['CITY']) . Region::getCnName($order['COUNTY']), // 收件市县
|
|
|
- 'post_code' => $order['ZIP_CODE'], // 收件人邮政编码 14000(test)
|
|
|
- 'address' => $order['ADDRESS'], // 送货地址
|
|
|
+ 'delivery_method_id' => '60', // 快递方式ID. 133(test)
|
|
|
+ 'warehouse_id' => '1', // 仓库ID.
|
|
|
+ 'country' => 'Malaysia', // 发件人国家
|
|
|
+ 'state' => 'Selangor', // , // 发件人省
|
|
|
+ 'city' => 'Kuala Lumpur', // 发件人市县
|
|
|
+ 'post_code' => '47620', // 发件人邮政编码
|
|
|
+ 'address' => '11, 2nd Floor, Jalan TP5, Taman Perindustrian UEP, Subang Jaya', // 发件人地址
|
|
|
+ 'telephone' => '0380210088', // 发件人电话号码
|
|
|
+ 'sender' => 'Elken', // 发件人名字
|
|
|
'consignee' => $order['CONSIGNEE_REAL_NAME'], // 收货人姓名,使用订单中的收货人真实姓名
|
|
|
'consignee_ic_number' => $order['CONSIGNEE_ID_NO'],
|
|
|
- 'telephone' => $order['MOBILE'], // 收件人电话号码
|
|
|
- 'sender' => $order['CONSIGNEE_REAL_NAME'],
|
|
|
'products' => [
|
|
|
[
|
|
|
'product_no' => $order['SKU_CODE'], // 客户系统中的产品编号
|
|
|
@@ -141,7 +133,7 @@ class Logistics
|
|
|
],
|
|
|
];
|
|
|
|
|
|
- LoggerTool::info(['actionLogisticsOrder', $order, $request]);
|
|
|
+ LoggerTool::info(['actionLogisticsOrder', $request]);
|
|
|
|
|
|
return $this->curl(self::createOrderUrl, $request);
|
|
|
}
|