Browse Source

fix: server name repeat

tokumeikoi 4 years ago
parent
commit
326fb5d918
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app/Services/ServerService.php

+ 3 - 3
app/Services/ServerService.php

@@ -360,13 +360,13 @@ class ServerService
 
     public function serverIsExist($name):bool
     {
-        if (ServerShadowsocks::where('name', $name)->first()) {
+        if (ServerShadowsocks::where('name', $name)->count() > 0) {
             return true;
         }
-        if (ServerTrojan::where('name', $name)->first()) {
+        if (ServerTrojan::where('name', $name)->count() > 0) {
             return true;
         }
-        if (Server::where('name', $name)->first()) {
+        if (Server::where('name', $name)->count() > 0) {
             return true;
         }
         return false;