Sfoglia il codice sorgente

客户端-增加将所有用户令牌设置为失效接口

sunxbiao 11 mesi fa
parent
commit
9b868df3a1
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      app/common/repositories/user/UserRepository.php

+ 4 - 2
app/common/repositories/user/UserRepository.php

@@ -1430,8 +1430,10 @@ class UserRepository extends BaseRepository
1430 1430
     public function checkToken(string $token)
1431 1431
     {
1432 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 1437
         $lastTime = Cache::get('user_' . $token);
1436 1438
         if (($lastTime + intval(Config::get('admin.token_valid_exp', 15)) * 60) > time())
1437 1439
             throw new AuthException('token 已过期');