shish 5 lat temu
rodzic
commit
7952371eb9

+ 12 - 14
app-mall/controllers/BaseController.php

@@ -34,7 +34,16 @@ class BaseController extends PublicController
         $this->shopId = $shopId;
         if (!empty($shopId)) {
             $shop = ShopClass::getById($shopId, true);
-            $this->shop = $shop;
+            if (!empty($shop)) {
+                $this->shop = $shop;
+                $sjId = $shop->sjId ?? 0;
+                $this->sjId = $sjId;
+                $sj = SjClass::getById($this->sjId, true);
+                if (empty($sj)) {
+                    util::fail('没有找到商家信息');
+                }
+                $this->sj = $sj;
+            }
         }
 
         if (httpUtil::isMiniProgram()) {
@@ -49,21 +58,10 @@ class BaseController extends PublicController
             }
             $this->user = $user;
             $this->isWx = util::isWx();
-
             if (!empty($shop)) {
-                $sjId = $shop->sjId ?? 0;
-                if (empty($sjId)) {
-                    util::fail('没有找到商家哦');
-                }
-                $sj = SjClass::getById($sjId, true);
-                if (empty($sj)) {
-                    util::fail('没有找到商家信息');
-                }
-                $this->sjId = $sjId;
-                $this->sj = $sj;
-                $this->sjExtend = MerchantExtendService::getBySjId($sjId);
+                $this->sjExtend = MerchantExtendService::getBySjId($this->sjId);
                 $userInfo = isset($user->attributes) ? $user->attributes : [];
-                $custom = CustomClass::replaceCustom($sjId, $userInfo, $shopId);
+                $custom = CustomClass::replaceCustom($this->sjId, $userInfo, $shopId);
                 if (!empty($custom)) {
                     $this->custom = $custom;
                     $customId = $custom['id'] ?? 0;

+ 0 - 2
app-mall/controllers/OrderController.php

@@ -5,8 +5,6 @@ namespace mall\controllers;
 use bizHd\wx\classes\WxOpenClass;
 use bizMall\goods\services\GoodsService;
 use bizMall\merchant\services\ExpressService;
-use bizMall\merchant\services\MerchantExtendService;
-use bizMall\merchant\services\MerchantService;
 use bizMall\order\classes\OrderClass;
 use bizMall\order\services\OrderGoodsService;
 use bizMall\order\services\OrderService;