Przeglądaj źródła

蜂鸟生成授权地址修改

shizhongqi 8 miesięcy temu
rodzic
commit
561d7151dd

+ 3 - 2
app-ghs/controllers/DeliveryController.php

@@ -122,7 +122,7 @@ class DeliveryController extends BaseController
     {
         $fengnaioAuth = new \common\components\delivery\platform\fengniao\Auth();
         $mainId = $this->mainId;
-        $redirectUrl = Yii::$app->params['ghsHost'] . '/delivery/fengniao-auth-callback' . '?mainId=' . $mainId;
+        $redirectUrl = Yii::$app->params['ghsHost'] . '/delivery/fengniao-auth-callback' . '?main_id=' . $mainId;
         $authUrl = $fengnaioAuth->generateAuthUrl($redirectUrl);
 
         util::success(['url'=>$authUrl]);
@@ -795,11 +795,12 @@ class DeliveryController extends BaseController
             // 保存授权信息到数据库
             $data = [
                 'mainId' => $mainId,
+                'merchantId' => $merchantId,
                 'shopId' => '',
                 'accessToken' => $result['access_token'],
                 'refreshToken' => $result['refresh_token'],
                 'expiresAt' => $result['expire_in'] + time(),
-                'authType' => 'all_store',
+                'authType' => $scope,
                 'platform' => 'fengniao'
             ];
             DeliveryAuthTokenClass::add($data);

+ 6 - 6
common/components/delivery/platform/fengniao/Auth.php

@@ -51,16 +51,16 @@ class Auth
      */
     public function generateAuthUrl($redirectUri)
     {
-        $redirectUri = urlencode($redirectUri);
+        //$redirectUri = urlencode($redirectUri);
         $params = [
-            'response_type' => 'code',
-            'client_id' => $this->appId,
-            'redirect_uri' => $redirectUri,
+            'appId' => $this->appId,
+            'devId' => 133146508, // 蜂鸟开放平台 【开发者中心】->【应用管理】->【发起商户授权】获得的
+            'authCallbackUrl' => $redirectUri,
         ];
-        
+
         // 构建URL
         $queryString = http_build_query($params);
-        return 'https://open.fengniao.com/auth?' . $queryString;
+        return 'https://open.ele.me/app-auth?' . $queryString;
     }
 
     /**