userModel->getInfoById($userId); if (!$userInfo) { return false; } Context::set($key, $userInfo); return $userInfo; } /** * @param $userId * @return void */ protected function checkBindPhone($userId): void { $userInfo = $this->getUserInfo($userId); if (!empty($userInfo->phone)) throw new ErrException('该账户已绑定手机号,无需重新绑定。若需更换手机号,请联系客服重置后再绑定'); } }