|
@@ -1430,8 +1430,10 @@ class UserRepository extends BaseRepository
|
|
1430
|
public function checkToken(string $token)
|
1430
|
public function checkToken(string $token)
|
|
1431
|
{
|
1431
|
{
|
|
1432
|
$has = Cache::has('user_' . $token);
|
1432
|
$has = Cache::has('user_' . $token);
|
|
1433
|
- if (!$has)
|
|
|
|
1434
|
- throw new AuthException('无效的token');
|
|
|
|
|
|
1433
|
+ if (!$has) {
|
|
|
|
1434
|
+ throw new ValidateException('请登录');
|
|
|
|
1435
|
+ // throw new AuthException('无效的token');
|
|
|
|
1436
|
+ }
|
|
1435
|
$lastTime = Cache::get('user_' . $token);
|
1437
|
$lastTime = Cache::get('user_' . $token);
|
|
1436
|
if (($lastTime + intval(Config::get('admin.token_valid_exp', 15)) * 60) > time())
|
1438
|
if (($lastTime + intval(Config::get('admin.token_valid_exp', 15)) * 60) > time())
|
|
1437
|
throw new AuthException('token 已过期');
|
1439
|
throw new AuthException('token 已过期');
|