params['ptStyle'] = dict::getDict('ptStyle', 'ghs'); // $headers = Yii::$app->getRequest()->getHeaders(); // $requestVersion = $headers->get('appVersion'); // $currentVersion = dict::getDict('appVersion'); // if ($requestVersion < $currentVersion) { // if (in_array($action->id, $this->guestAccess) == false) { // //util::fail('请先升级系统'); // } // } //token验证 $adminId = jwt::getLoginId(); //将石少华的号模拟成别人的号进行测试,有多处需要同步修改,关键词 simulate_other ssh 20250717 $simulateKey = 'simulate_admin_id'; $simulateId = Yii::$app->redis->executeCommand('GET', [$simulateKey]); if (!empty($simulateId) && $simulateId > 0) { if (getenv('YII_ENV') == 'production') { if ($adminId == 4) { $adminId = $simulateId; } } else { if ($adminId == 919) { $adminId = $simulateId; } } } if (empty($adminId) && in_array($action->id, $this->guestAccess) == false) { util::notLogin(); } $this->adminId = $adminId; $admin = AdminService::getById($adminId, true); if (empty($admin) && in_array($action->id, $this->guestAccess) == false) { util::logout('帐号无效'); } $this->admin = $admin; //后台 $currentShopId = $admin->currentGhsShopId ?? 0; if (empty($currentShopId)) { if (in_array($action->id, $this->guestAccess) == false) { util::fail('请注册登录'); } } else { $this->shopId = $currentShopId; $shop = ShopClass::getById($currentShopId, true); if (empty($shop)) { util::fail('没有找到您的门店'); } $this->shop = $shop; $mainId = $shop->mainId ?? 0; $this->mainId = $mainId; $main = MainClass::getById($mainId, true); if (empty($main)) { util::fail('没有main信息17,shopId:' . $this->shopId); } $this->main = $main; $shopExt = ShopExtClass::getByCondition(['shopId' => $currentShopId], true); if (empty($shopExt)) { util::fail('门店信息有问题,请联系管理员'); } $this->shopExt = $shopExt; $shopAdmin = ShopAdminClass::getByCondition(['mainId' => $mainId, 'adminId' => $adminId, 'delStatus' => 0], true); if (empty($shopAdmin)) { util::logout('没有找到员工'); } // if (isset($shopAdmin->delStatus) && $shopAdmin->delStatus == 1) { //第95行查询时已限定 'delStatus' => 0, $shopAdmin->delStatus == 1 永远不会成立 // util::fail('您不是本店员工哦'); // } if (isset($shopAdmin->status) && $shopAdmin->status == 0) { util::fail('您已被平台禁止登录'); } $this->shopAdmin = $shopAdmin; $this->shopAdminId = $shopAdmin->id ?? 0; $sjId = $shop->sjId; $this->sjId = $sjId; $sj = SjClass::getById($sjId, true); $this->sj = $sj; $sjExtend = MerchantExtendService::getBySjId($sjId, true); $this->sjExtend = $sjExtend; } return parent::beforeAction($action); } }