Sfoglia il codice sorgente

Update RegisterController.php

aiden3434 7 anni fa
parent
commit
95a7435ed9
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7 2
      app/Http/Controllers/RegisterController.php

+ 7 - 2
app/Http/Controllers/RegisterController.php

@@ -147,9 +147,14 @@ class RegisterController extends Controller
                 }
             }
 
-            // 最后一个可用端口
+            // 获取可用端口
             $last_user = User::query()->orderBy('id', 'desc')->first();
-            $port = self::$config['is_rand_port'] ? $this->getRandPort() : $last_user->port + 1;
+            $port = self::$config['is_rand_port'] ? $this->getRandPort() : $this->getOnlyPort();
+            if ($port > self::$config['max_port']) {
+                $request->session()->flash('errorMsg', '用户已满');
+
+                return Redirect::back()->withInput();
+            }
 
             // 默认加密方式、协议、混淆
             $method = SsConfig::query()->where('type', 1)->where('is_default', 1)->first();