This commit is contained in:
root 2019-11-06 00:53:02 +08:00
parent 2ce6822899
commit f0f023f540
2 changed files with 9 additions and 2 deletions

View File

@ -42,6 +42,8 @@ class ServerController extends Controller
$server->tls = $request->input('tls');
$server->tags = $request->input('tags') ? json_encode($request->input('tags')) : NULL;
$server->rate = $request->input('rate');
$server->network = $request->input('network');
$server->settings = $request->input('settings');
return response([
'data' => $server->save()
]);

View File

@ -21,7 +21,9 @@ class ServerSave extends FormRequest
'server_port' => 'required',
'tls' => 'required',
'tags' => 'array',
'rate' => 'required|numeric'
'rate' => 'required|numeric',
'network' => 'required|in:tcp,mkcp,websocket,http2,domainsocket,quic',
'settings' => 'json'
];
}
@ -37,7 +39,10 @@ class ServerSave extends FormRequest
'tls.required' => 'TLS不能为空',
'tags.array' => '标签格式不正确',
'rate.required' => '倍率不能为空',
'rate.numeric' => '倍率格式不正确'
'rate.numeric' => '倍率格式不正确',
'network.required' => '传输协议不能为空',
'network.in' => '传输协议格式不正确',
'settings.json' => '传输协议配置格式不正确'
];
}
}