|
|
@@ -11,9 +11,9 @@ class Logistics
|
|
|
const testDomain = 'http://warehouse.worldsyntech.com';
|
|
|
|
|
|
// 1.获取bearer token,此token是其他api调用时的必传参数.
|
|
|
- const authenticationUrl = '/index.php?route=rest/admin_security/api_login&grant_type=client_credentials';
|
|
|
+ const authenticationUrl = 'https://warehouse.taoplus.com.my/index.php?route=rest/admin_security/api_login&grant_type=client_credentials';
|
|
|
// 2.创建订单和产品(以前不存在/已提交的产品).
|
|
|
- const createOrderUrl = '/index.php?route=rest/warehouse_api/add_order';
|
|
|
+ const createOrderUrl = 'https://warehouse.taoplus.com.my/index.php?route=rest/warehouse_api/add_order';
|
|
|
// 3.获取产品/包裹的重量和状态.
|
|
|
const getProductUrl = '/index.php?route=rest/warehouse_api/get_order_product';
|
|
|
// 4.获取订单重量,m3,包装的包裹数量,费用跟踪号码和状态.
|
|
|
@@ -47,9 +47,9 @@ class Logistics
|
|
|
|
|
|
function __construct()
|
|
|
{
|
|
|
- // if (!\Yii::$app->redis->get(self::wstLogisticsBearerTokenKey)) {
|
|
|
+ if (!\Yii::$app->redis->get(self::wstLogisticsBearerTokenKey)) {
|
|
|
$this->getAuthentication();
|
|
|
- // }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function getDomain()
|
|
|
@@ -92,9 +92,9 @@ class Logistics
|
|
|
];
|
|
|
|
|
|
|
|
|
- LoggerTool::info(['curl', $this->getDomain() . self::authenticationUrl, $this->getDomain() . self::createOrderUrl]);
|
|
|
+ LoggerTool::info(['curl', self::authenticationUrl, self::createOrderUrl]);
|
|
|
|
|
|
- $ch = curl_init($this->getDomain() . self::authenticationUrl);
|
|
|
+ $ch = curl_init(self::authenticationUrl);
|
|
|
header('Content-Type: application/json');
|
|
|
$authorization = "Authorization: Basic " . Yii::$app->params['wst']['baseToken'];
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', $authorization]);
|
|
|
@@ -103,6 +103,9 @@ class Logistics
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request));
|
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
|
$response = curl_exec($ch);
|
|
|
+
|
|
|
+ LoggerTool::info(['getAuthentication', $response]);
|
|
|
+
|
|
|
curl_close($ch);
|
|
|
|
|
|
$result = json_decode($response, true);
|
|
|
@@ -143,7 +146,7 @@ class Logistics
|
|
|
|
|
|
LoggerTool::info(['actionLogisticsOrder', $order, $request]);
|
|
|
|
|
|
- return $this->curl($this->getDomain() . self::createOrderUrl, $request);
|
|
|
+ return $this->curl(self::createOrderUrl, $request);
|
|
|
}
|
|
|
|
|
|
// 3.获取产品/包裹的重量和状态.
|