adminId = $adminId; $admin = AdminService::getById($adminId); if (empty($admin)) { util::fail('帐号无效'); } $this->admin = $admin; $header = httpUtil::getHeader(); $lookShopId = $header['shop-id'] ?? 0; if (!empty($lookShopId)) { //商城和下单页 if (in_array($action->id, $this->guestAccessAction) == false) { util::fail('您没有权限访问哦~'); } $shop = ShopClass::getById($lookShopId); if (empty($shop)) { util::fail('没有找到店铺'); } $this->lookShopId = $lookShopId; $sjId = $shop['merchantId'] ?? 0; $sj = MerchantService::getMerchantById($sjId); $sjExtend = MerchantExtendClass::getByMerchantId($sjId); } else { //后台 $currentShopId = $admin['currentShopId'] ?? 0; if (empty($currentShopId) && in_array($action->id, $this->guestAccessAction) == false) { util::fail('您没有权限访问哦!'); } $this->shopId = $currentShopId; $shop = ShopService::getById($currentShopId); if (empty($shop)) { util::fail('没有找到您管理的门店'); } $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]); if (empty($shopAdmin)) { util::fail('没有找到员工信息'); } $this->shopAdmin = $shopAdmin; $this->shopAdminId = $shopAdmin['id'] ?? 0; $sjId = $shop['merchantId']; $this->sjId = $sjId; $sj = MerchantService::getMerchantById($sjId); $this->sj = $sj; $sjExtend = MerchantExtendService::getByMerchantId($sjId); $this->sjExtend = $sjExtend; } return parent::beforeAction($action); } }