shish 2 лет назад
Родитель
Сommit
38257aedae
2 измененных файлов с 15 добавлено и 4 удалено
  1. 11 1
      app-pt/controllers/WxOpenController.php
  2. 4 3
      common/components/wxUtil.php

+ 11 - 1
app-pt/controllers/WxOpenController.php

@@ -450,7 +450,17 @@ class WxOpenController extends PublicController
             wxUtil::privacySetting($merchant, $isOpen);
         }
         if ($actId == 18) {
-            wxUtil::applySetOrderPathInfo($merchant, $isOpen);
+            $open = [];
+            if ($isOpen == 1) {
+                $open = \biz\wx\classes\WxOpenClass::getByCondition(['style' => dict::getDict('ptStyle', 'hd')]);
+            } elseif ($isOpen == 2) {
+                $open = \biz\wx\classes\WxOpenClass::getByCondition(['style' => dict::getDict('ptStyle', 'ghs')]);
+            } elseif ($isOpen == 3) {
+                $open = \biz\wx\classes\WxOpenClass::getByCondition(['style' => dict::getDict('ptStyle', 'mall')]);
+            } else {
+                util::stop('没有找到平台信息');
+            }
+            wxUtil::applySetOrderPathInfo($merchant, $open);
         }
     }
 

+ 4 - 3
common/components/wxUtil.php

@@ -1585,12 +1585,13 @@ class wxUtil
         return $behind . $fileName;
     }
 
-    public static function applySetOrderPathInfo($merchant, $isOpen = 0)
+    public static function applySetOrderPathInfo($merchant, $open)
     {
-        $accessToken = self::getMiniProgramAccessToken($merchant, $isOpen);
-        $url = "https://api.weixin.qq.com/wxa/security/applysetorderpathinfo?access_token={$accessToken}";
+        $accessToken = self::getComponentAccessToken($open);
+        $url = "https://api.weixin.qq.com/wxa/security/applysetorderpathinfo?component_access_token={$accessToken}";
         $curl = new curl\Curl();
         $appId = $merchant['miniAppId'] ?? '';
+
         $data = [
             "batch_req" => [
                 "appid_list" => [$appId],