Преглед изворни кода

1. fix bug 2. 顺丰测试环境启用正式环境的账号

shizhongqi пре 8 месеци
родитељ
комит
487af69d4e

+ 9 - 3
common/components/delivery/platform/huolala/Auth.php

@@ -86,9 +86,15 @@ class Auth
     {
         $isProduction = getenv('YII_ENV') == 'production';
 
-        // 货拉拉配置(需要替换为真实的appKey和appSecret)
-        $this->appKey = '8S2uZQrWwM1mkG2Cj576PsMiNIe25UNT';
-        $this->appSecret = 'olzor07UgmUWaagahNGQAKQKXRtvhK8j';
+        if($isProduction){
+            // 货拉拉配置(需要替换为真实的appKey和appSecret)
+            $this->appKey = 'gBhmCdWtX7hi7qnljduk0yK21XgQg8w3';
+            $this->appSecret = 'bARxI68FFHpEXAcCQ23fxVQyxtJ9RONU';
+        }else{
+            // 货拉拉配置(需要替换为真实的appKey和appSecret)
+            $this->appKey = '8S2uZQrWwM1mkG2Cj576PsMiNIe25UNT';
+            $this->appSecret = 'olzor07UgmUWaagahNGQAKQKXRtvhK8j';
+        }
         
         // 根据环境设置沙箱标志
         $this->isSandbox = !$isProduction;

+ 3 - 3
common/components/delivery/platform/shunfeng/Shunfeng.php

@@ -21,10 +21,10 @@ class Shunfeng
     public function __construct($accessToken = '', $shopId = 0)
     {
         // 根据环境设置基础URL
-        if (getenv('YII_ENV') == 'production') {
+        if (getenv('YII_ENV') == 'dev') { // TODO 先变更为测试
             $this->baseUrl = 'https://openic.sf-express.com/open/api/external/';
-            $this->devId = 1741530942;
-            $this->appSecret = '07b3f83d19a4a9f89322976c936faf92';
+            $this->devId = 1594082399;
+            $this->appSecret = '9025c4f5ad93e8e08e947f02d0cde652';
             $this->shopId = $shopId;
         } else {
             $this->baseUrl = 'https://openic.sf-express.com/open/api/external/';

+ 2 - 2
common/components/delivery/services/DispatchService.php

@@ -42,7 +42,7 @@ class DispatchService
                 }
 
                 //检测 token 是否即将过期
-                $tokenExpireTime = $pt['expireAt'];
+                $tokenExpireTime = $pt['expiresAt'];
                 if ($tokenExpireTime < time() + 86400 * 5) {
                     Yii::info('刷新 token: ' . $pt['platform'] . ',refreshToken: ' . $pt['refreshToken'] . ',merchantId: ' . $pt['merchantId']);
                     $this->refreshToken($pt['platform'], $pt['refreshToken'], ['merchantId' => $pt['merchantId']]);
@@ -68,7 +68,7 @@ class DispatchService
                     break;
             }
             $this->platformName = $platform;
-            if($authPlatform['expireAt'] < time() + 86400 * 5) {    
+            if($authPlatform['expiresAt'] < time() + 86400 * 5) {
                 Yii::info('刷新 token: ' . $platform . ',refreshToken: ' . $authPlatform['refreshToken'] . ',merchantId: ' . $authPlatform['merchantId']);
                 $this->refreshToken($platform, $authPlatform['refreshToken'], ['merchantId' => $authPlatform['merchantId']]);
             }