This commit is contained in:
as2252258@163.com
2021-04-23 02:28:47 +08:00
parent c393222393
commit 10c9e1801b
+4 -5
View File
@@ -418,13 +418,13 @@ mlAZUEjsoaT9vjvjGTxl3uCm0TX5KTgtSJIt2kA1tYVjQef+/iZTHxY=
{ {
$model = $this->getUserModel(); $model = $this->getUserModel();
if (empty($model)) { if (empty($model)) {
throw new AuthException('授权信息已过期!'); return (int)$this->addError('授权信息已过期!');
} }
if (!isset($model['user'])) { if (!isset($model['user'])) {
throw new AuthException('授权信息错误!'); return (int)$this->addError('授权信息错误!');
} }
if (!$this->check($this->data, (int)$model['user'])) { if (!$this->check($this->data, (int)$model['user'])) {
throw new AuthException('授权信息不合法!'); return (int)$this->addError('授权信息不合法!');
} }
$this->expireRefresh(); $this->expireRefresh();
@@ -478,13 +478,12 @@ mlAZUEjsoaT9vjvjGTxl3uCm0TX5KTgtSJIt2kA1tYVjQef+/iZTHxY=
/** /**
* @return bool|array * @return bool|array
* @throws AuthException
* @throws Exception * @throws Exception
*/ */
private function getUserModel(): bool|array private function getUserModel(): bool|array
{ {
if (!isset($this->data['token'])) { if (!isset($this->data['token'])) {
throw new AuthException('暂无访问权限!'); return $this->addError('暂无访问权限!');
} }
$key = $this->authKey($this->getSource(), $this->data['token']); $key = $this->authKey($this->getSource(), $this->data['token']);
return $this->getRedis()->hGetAll($key); return $this->getRedis()->hGetAll($key);