rm: remove server name check

This commit is contained in:
tokumeikoi 2021-03-22 02:33:33 +09:00
parent 326fb5d918
commit 4e2e3cd2a0
4 changed files with 0 additions and 21 deletions

View File

@ -14,8 +14,6 @@ class ShadowsocksController extends Controller
public function save(ServerShadowsocksSave $request) public function save(ServerShadowsocksSave $request)
{ {
$params = $request->validated(); $params = $request->validated();
$serverService = new ServerService();
if ($serverService->serverIsExist($params['name'])) abort(500, '节点名称已存在,请更换名称再试');
$params['group_id'] = json_encode($params['group_id']); $params['group_id'] = json_encode($params['group_id']);
if (isset($params['tags'])) { if (isset($params['tags'])) {
$params['tags'] = json_encode($params['tags']); $params['tags'] = json_encode($params['tags']);

View File

@ -14,8 +14,6 @@ class TrojanController extends Controller
public function save(ServerTrojanSave $request) public function save(ServerTrojanSave $request)
{ {
$params = $request->validated(); $params = $request->validated();
$serverService = new ServerService();
if ($serverService->serverIsExist($params['name'])) abort(500, '节点名称已存在,请更换名称再试');
$params['group_id'] = json_encode($params['group_id']); $params['group_id'] = json_encode($params['group_id']);
if (isset($params['tags'])) { if (isset($params['tags'])) {
$params['tags'] = json_encode($params['tags']); $params['tags'] = json_encode($params['tags']);

View File

@ -14,9 +14,6 @@ class V2rayController extends Controller
public function save(ServerV2raySave $request) public function save(ServerV2raySave $request)
{ {
$params = $request->validated(); $params = $request->validated();
$serverService = new ServerService();
if ($serverService->serverIsExist($params['name'])) abort(500, '节点名称已存在,请更换名称再试');
$params['group_id'] = json_encode($params['group_id']); $params['group_id'] = json_encode($params['group_id']);
if (isset($params['tags'])) { if (isset($params['tags'])) {
$params['tags'] = json_encode($params['tags']); $params['tags'] = json_encode($params['tags']);

View File

@ -357,18 +357,4 @@ class ServerService
} }
return $server->toArray(); return $server->toArray();
} }
public function serverIsExist($name):bool
{
if (ServerShadowsocks::where('name', $name)->count() > 0) {
return true;
}
if (ServerTrojan::where('name', $name)->count() > 0) {
return true;
}
if (Server::where('name', $name)->count() > 0) {
return true;
}
return false;
}
} }