shish 5 năm trước cách đây
mục cha
commit
bee3ef200e
2 tập tin đã thay đổi với 37 bổ sung12 xóa
  1. 19 5
      app-pt/controllers/WxOpenController.php
  2. 18 7
      common/components/wxUtil.php

+ 19 - 5
app-pt/controllers/WxOpenController.php

@@ -263,15 +263,15 @@ class WxOpenController extends PublicController
         $host = Yii::$app->request->getHostInfo();
         if (strpos($host, 'huaml.com') !== false || strpos($host, 'huahb.cn') !== false) {
             //花店
-            Yii::$app->params['ptStyle']  = dict::getDict('ptStyle', 'hd');
+            Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'hd');
             $isOpen = 1;
         } elseif (strpos($host, 'theflorist.cn') !== false || strpos($host, 'zhiguanhua.cn') !== false) {
             //商城
-            Yii::$app->params['ptStyle']  = dict::getDict('ptStyle', 'mall');
+            Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'mall');
             $isOpen = 3;
         } elseif (strpos($host, 'hzghd.com') !== false || strpos($host, 'wixhb.com') !== false) {
             //供应商
-            Yii::$app->params['ptStyle']  = dict::getDict('ptStyle', 'ghs');
+            Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'ghs');
             $isOpen = 2;
         } else {
             util::stop('域名无效');
@@ -392,7 +392,15 @@ class WxOpenController extends PublicController
 
         //将第三方提交的代码包提交审核
         if ($id == 9) {
-            wxUtil::miniSubmitAudit($merchant, '', $isOpen);
+            $returnInfo = wxUtil::miniSubmitAudit($merchant, '', $isOpen);
+            echo "<pre>";
+            print_r($returnInfo);
+            $auditId = $returnInfo['auditid'] ?? '';
+            if (!empty($auditId)) {
+                $respond = wxUtil::speedupAudit($merchant, $auditId, $isOpen);
+                echo "加急审核{$auditId}";
+                print_r($respond);
+            }
         }
 
         //查询最新一次提交的审核状态
@@ -410,6 +418,12 @@ class WxOpenController extends PublicController
         if ($id == 12) {
             wxUtil::rollbackCheck($merchant, $isOpen);
         }
+
+        //撤回审核
+        if ($id == 13) {
+            wxUtil::queryQuota($merchant, $isOpen);
+        }
+
         //生成 申请会员页 的小程序码
         if ($id == 13) {
             wxUtil::generateMemberCode($merchant, $isOpen);
@@ -490,7 +504,7 @@ class WxOpenController extends PublicController
     public function actionApi()
     {
         $get = Yii::$app->request->get();
-        $style = $get['style'] ?? dict::getDict('ptStyle','hd');
+        $style = $get['style'] ?? dict::getDict('ptStyle', 'hd');
         $openData = file_get_contents('php://input');
         if (isset ($openData) == false || empty($openData)) {
             util::stop('has no post data');

+ 18 - 7
common/components/wxUtil.php

@@ -1267,7 +1267,7 @@ class wxUtil
         if ($imgHas === false) {
             $imgHost = str_replace('http', 'https', $imgHost);
         }
-        $imgHost = rtrim($imgHost,'/');
+        $imgHost = rtrim($imgHost, '/');
 
         $socket = str_replace("https", "", $currentHost);
         $socket = str_replace("http", "", $socket);
@@ -1432,17 +1432,17 @@ class wxUtil
     }
 
     //小程序加急审核 ssh 2020.4.20
-    public static function speedupAudit($merchant, $id, $isOpen = 0)
+    public static function speedupAudit($merchant, $auditId, $isOpen = 0)
     {
         $accessToken = self::getMiniProgramAccessToken($merchant, $isOpen);
         $url = "https://api.weixin.qq.com/wxa/speedupaudit?access_token=" . $accessToken;
         $curl = new curl\Curl();
         $data = [
-            "auditid" => $id
+            "auditid" => $auditId
         ];
         $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
         $respond = Json::decode($result);
-        print_r($respond);
+        return $respond;
     }
 
     //获取小程序的第三方提交代码的页面配置
@@ -1466,7 +1466,7 @@ class wxUtil
 
         if (getenv('YII_ENV') == 'production') {
             $code = '196401';
-        }else{
+        } else {
             $code = '1964';
         }
 
@@ -1489,8 +1489,7 @@ class wxUtil
 
         $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
         $respond = Json::decode($result);
-        echo "<pre>";
-        print_r($respond);
+        return $respond;
     }
 
     //查询最新一次提交的审核状态
@@ -1529,6 +1528,18 @@ class wxUtil
         print_r($respond);
     }
 
+    //查询服务商的当月提审限额(quota)和加急次数
+    public static function queryQuota($merchant, $isOpen = 0)
+    {
+        $accessToken = self::getMiniProgramAccessToken($merchant, $isOpen);
+        $url = "https://api.weixin.qq.com/wxa/queryquota?access_token=" . $accessToken;
+        $curl = new curl\Curl();
+        $result = $curl->get($url);
+        $respond = Json::decode($result);
+        echo "<pre>";
+        print_r($respond);
+    }
+
     //申请会员的小程序码
     public static function generateMemberCode($merchant, $shopId, $isOpen = 0)
     {