mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update: new feature route manage
This commit is contained in:
		| @@ -3,6 +3,7 @@ | ||||
| namespace App\Services; | ||||
|  | ||||
| use App\Models\ServerLog; | ||||
| use App\Models\ServerRoute; | ||||
| use App\Models\ServerShadowsocks; | ||||
| use App\Models\User; | ||||
| use App\Models\ServerV2ray; | ||||
| @@ -107,7 +108,6 @@ class ServerService | ||||
|         return $servers; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public function getAvailableUsers($groupId) | ||||
|     { | ||||
|         return User::whereIn('group_id', $groupId) | ||||
| @@ -183,7 +183,7 @@ class ServerService | ||||
|         return $server->toArray(); | ||||
|     } | ||||
|  | ||||
|     public function mergeData(&$servers) | ||||
|     private function mergeData(&$servers) | ||||
|     { | ||||
|         foreach ($servers as $k => $v) { | ||||
|             $serverType = strtoupper($servers[$k]['type']); | ||||
| @@ -217,4 +217,23 @@ class ServerService | ||||
|         array_multisort($tmp, SORT_ASC, $servers); | ||||
|         return $servers; | ||||
|     } | ||||
|  | ||||
|     public function getRoutes(array $routeIds) | ||||
|     { | ||||
|         return ServerRoute::select(['id', 'match', 'action', 'action_value'])->whereIn('id', $routeIds)->get(); | ||||
|     } | ||||
|  | ||||
|     public function getServer($serverId, $serverType) | ||||
|     { | ||||
|         switch ($serverType) { | ||||
|             case 'v2ray': | ||||
|                 return ServerV2ray::find($serverId); | ||||
|             case 'shadowsocks': | ||||
|                 return ServerShadowsocks::find($serverId); | ||||
|             case 'trojan': | ||||
|                 return ServerTrojan::find($serverId); | ||||
|             default: | ||||
|                 return false; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user