shish пре 2 година
родитељ
комит
22729ebf3a
2 измењених фајлова са 24 додато и 1 уклоњено
  1. 3 0
      app-pt/controllers/WxOpenController.php
  2. 21 1
      common/components/wxUtil.php

+ 3 - 0
app-pt/controllers/WxOpenController.php

@@ -449,6 +449,9 @@ class WxOpenController extends PublicController
         if ($actId == 17) {
             wxUtil::privacySetting($merchant, $isOpen);
         }
+        if ($actId == 18) {
+            wxUtil::applySetOrderPathInfo($merchant, $isOpen);
+        }
     }
 
     public function actionResult()

+ 21 - 1
common/components/wxUtil.php

@@ -1585,6 +1585,25 @@ class wxUtil
         return $behind . $fileName;
     }
 
+    public static function applySetOrderPathInfo($merchant, $isOpen = 0)
+    {
+        $accessToken = self::getMiniProgramAccessToken($merchant, $isOpen);
+        $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],
+                "path" => "pages/order/list",
+            ],
+        ];
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        $respond = Json::decode($result);
+        echo "<pre>";
+        print_r($respond);
+        echo '申请设置订单页path信息 设置OK';
+    }
+
     //隐私协议设置 ssh 20211213
     //接口说明 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html
     public static function privacySetting($merchant, $isOpen = 0)
@@ -1636,7 +1655,8 @@ class wxUtil
         $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
         $respond = Json::decode($result);
         echo "<pre>";
-        print_r($respond);echo '隐私设置OK';
+        print_r($respond);
+        echo '隐私设置OK';
     }
 
     //收款小程序码