sjId = $sjId; $this->sj = $sj; $this->shopId = $shopId; $this->sjExtend = MerchantExtendService::getByMerchantId($sjId); $this->isWx = util::isWx(); if (empty($userId)) { $this->validate = false; } else { $this->validate = true; $this->userId = $userId; $userInfo = UserService::getUserInfo($userId); if (empty($userInfo)) { util::fail('没有用户信息'); } $this->user = $userInfo; $custom = CustomClass::getCurrentCustom($sjId, $userInfo); if (empty($custom)) { util::fail('没有找到客户'); } $this->custom = $custom; $customId = $custom['id'] ?? 0; $this->customId = $customId; } //游客可以访问的方法 if (in_array($action->id, $this->guestAccessAction)) { $this->validate = true; } if ($this->validate == false) { util::notLogin(); } return parent::beforeAction($action); } }