Browse Source

小程序

shish 6 years ago
parent
commit
cc47160043
1 changed files with 23 additions and 17 deletions
  1. 23 17
      app/saas/controllers/WxOpenController.php

+ 23 - 17
app/saas/controllers/WxOpenController.php

@@ -272,28 +272,11 @@ class WxOpenController extends BaseController
 
         $extend = MerchantExtendClass::getByMerchantId($id);
 
-        if (isset($authorize_info['MiniProgramInfo']) && !empty($authorize_info['MiniProgramInfo'])) {
-            if (isset($extend['miniAppId']) && !empty($extend['miniAppId'])) {
-                if ($extend['miniAppId'] != $authorizeAppId) {
-                    util::stop('授权的小程序与商家已绑定的小程序不一致');
-                }
-            } else {
-                util::stop('数据库请先填写小程序 miniAppId miniAppSecret');
-            }
-        } else {
-            if (isset($extend['wxAppId']) && !empty($extend['wxAppId'])) {
-                if ($extend['wxAppId'] != $authorizeAppId) {
-                    util::stop('授权的公众号与商家已绑定的公众号不一致');
-                }
-            }
-        }
-
         $open = WxOpenService::getOpen();
         $time = time();
 
         //小程序
         if (isset($authorize_info['MiniProgramInfo']) && !empty($authorize_info['MiniProgramInfo'])) {
-
             $miniData = [
                 'miniAppId' => $authorizeAppId,
                 'miniAuth' => 1,
@@ -310,6 +293,29 @@ class WxOpenController extends BaseController
                 WxOpenService::updateOpen(['wx_mini_base_id' => $wxMiniBaseId]);
                 util::stop('开放平台成功绑定小程序');
             }
+        }
+
+        if (isset($authorize_info['MiniProgramInfo']) && !empty($authorize_info['MiniProgramInfo'])) {
+            if (isset($extend['miniAppId']) && !empty($extend['miniAppId'])) {
+                if ($extend['miniAppId'] != $authorizeAppId) {
+                    util::stop('授权的小程序与商家已绑定的小程序不一致');
+                }
+            } else {
+                util::stop('数据库请先填写小程序 miniAppId miniAppSecret');
+            }
+        } else {
+            if (isset($extend['wxAppId']) && !empty($extend['wxAppId'])) {
+                if ($extend['wxAppId'] != $authorizeAppId) {
+                    util::stop('授权的公众号与商家已绑定的公众号不一致');
+                }
+            }
+        }
+
+
+        //小程序
+        if (isset($authorize_info['MiniProgramInfo']) && !empty($authorize_info['MiniProgramInfo'])) {
+
+
 
             xhMerchantExtendService::updateByMerchantId($id, $miniData);
             MerchantService::updateById($id, ['miniAppId' => $authorizeAppId]);