框架升级及修复升级后的bug
This commit is contained in:
@@ -34,8 +34,14 @@ class Token extends Api
|
||||
$token = $this->auth->getToken();
|
||||
\app\common\library\Token::delete($token);
|
||||
//创建新Token
|
||||
$token = Random::uuid();
|
||||
\app\common\library\Token::set($token, $this->auth->id, 2592000);
|
||||
$attempts = 0;
|
||||
do {
|
||||
$token = Random::uuid();
|
||||
$result = \app\common\library\Token::set($token, $this->auth->id, 2592000);
|
||||
} while (!$result && ++$attempts < 5);
|
||||
if (!$result) {
|
||||
$this->error('Failed to generate token');
|
||||
}
|
||||
$tokenInfo = \app\common\library\Token::get($token);
|
||||
$this->success('', ['token' => $tokenInfo['token'], 'expires_in' => $tokenInfo['expires_in']]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user