webman迁移
This commit is contained in:
@@ -222,8 +222,19 @@ class Auth extends \ba\Auth
|
||||
}
|
||||
$info = $this->model->toArray();
|
||||
$info = array_intersect_key($info, array_flip($this->getAllowFields()));
|
||||
$info['token'] = $this->getToken();
|
||||
$info['refresh_token'] = $this->getRefreshToken();
|
||||
// 与 ThinkPHP 一致:token 为主认证令牌,refresh_token 仅 keep=true 时有值
|
||||
$token = $this->token;
|
||||
if (!$token && $this->loginEd) {
|
||||
$token = Random::uuid();
|
||||
Token::set($token, self::TOKEN_TYPE, $this->model->id, $this->keepTime);
|
||||
$this->token = $token;
|
||||
}
|
||||
$info['token'] = $token ?: '';
|
||||
$info['refresh_token'] = $this->refreshToken ?: '';
|
||||
// last_login_time 与 ThinkPHP 一致返回整数时间戳
|
||||
if (isset($info['last_login_time'])) {
|
||||
$info['last_login_time'] = (int) $info['last_login_time'];
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user