|
|
@@ -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;
|