validate = false; } else { $admin = AdminService::getById($adminId); if (empty($admin)) { util::fail('帐号无效'); } //取不到门店id可能被清缓存,需要重新登陆,$shopId = 0 则表示非管理员,没有关联的门店,只可以访问官网 $shopId = $admin['currentShopId'] ?? 0; if (is_numeric($shopId) == false) { util::notLogin('登陆已失效,请重新登陆'); } if (!empty($shopId)) { $shop = ShopService::getById($shopId); if (empty($shop)) { util::fail('没有找到您的门店'); } $sjId = $shop['merchantId']; $sj = MerchantService::getMerchantById($sjId); $sjExtend = MerchantExtendService::getByMerchantId($sjId); } $this->shopId = $shopId; } //游客可以访问的方法 if (in_array($action->id, $this->withoutLoginAction)) { $this->validate = true; } if ($this->validate == false) { util::notLogin(); } $this->admin = $admin; $this->adminId = $adminId; $this->sjId = $sjId; $this->sj = $sj; $this->sjExtend = $sjExtend; return parent::beforeAction($action); } }