diff --git a/app/Http/Controllers/Client/AppController.php b/app/Http/Controllers/Client/AppController.php index ad616fde..779eb5be 100644 --- a/app/Http/Controllers/Client/AppController.php +++ b/app/Http/Controllers/Client/AppController.php @@ -87,7 +87,7 @@ class AppController extends Controller $json->outbound->settings->vnext[0]->address = (string)$server->host; $json->outbound->settings->vnext[0]->port = (int)$server->port; $json->outbound->settings->vnext[0]->users[0]->id = (string)$user->uuid; - $json->outbound->settings->vnext[0]->users[0]->alterId = (int)$user->v2ray_alter_id; + $json->outbound->settings->vnext[0]->users[0]->alterId = (int)$server->alter_id; $json->outbound->settings->vnext[0]->remark = (string)$server->name; $json->outbound->streamSettings->network = $server->network; if ($server->networkSettings) { diff --git a/app/Http/Controllers/Server/DeepbworkController.php b/app/Http/Controllers/Server/DeepbworkController.php index b8275ce7..43f8c3ab 100644 --- a/app/Http/Controllers/Server/DeepbworkController.php +++ b/app/Http/Controllers/Server/DeepbworkController.php @@ -47,12 +47,11 @@ class DeepbworkController extends Controller $user->v2ray_user = [ "uuid" => $user->uuid, "email" => sprintf("%s@v2board.user", $user->uuid), - "alter_id" => $user->v2ray_alter_id, - "level" => $user->v2ray_level, + "alter_id" => $server->alter_id, + "level" => 0, ]; unset($user['uuid']); - unset($user['v2ray_alter_id']); - unset($user['v2ray_level']); + unset($user['email']); array_push($result, $user); } return response([ diff --git a/app/Http/Controllers/Server/TrojanTidalabController.php b/app/Http/Controllers/Server/TrojanTidalabController.php index 96c599e9..fb1f3377 100644 --- a/app/Http/Controllers/Server/TrojanTidalabController.php +++ b/app/Http/Controllers/Server/TrojanTidalabController.php @@ -48,8 +48,7 @@ class TrojanTidalabController extends Controller "password" => $user->uuid, ]; unset($user['uuid']); - unset($user['v2ray_alter_id']); - unset($user['v2ray_level']); + unset($user['email']); array_push($result, $user); } return response([ diff --git a/app/Http/Requests/Admin/ServerV2raySave.php b/app/Http/Requests/Admin/ServerV2raySave.php index 9003da20..43f711ed 100755 --- a/app/Http/Requests/Admin/ServerV2raySave.php +++ b/app/Http/Requests/Admin/ServerV2raySave.php @@ -24,6 +24,7 @@ class ServerV2raySave extends FormRequest 'tls' => 'required', 'tags' => 'nullable|array', 'rate' => 'required|numeric', + 'alert_id' => 'required|integer', 'network' => 'required|in:tcp,kcp,ws,http,domainsocket,quic', 'networkSettings' => '', 'ruleSettings' => '', diff --git a/app/Services/ServerService.php b/app/Services/ServerService.php index 29669777..9c252794 100644 --- a/app/Services/ServerService.php +++ b/app/Services/ServerService.php @@ -121,9 +121,7 @@ class ServerService 'u', 'd', 'transfer_enable', - 'uuid', - 'v2ray_alter_id', - 'v2ray_level' + 'uuid' ]) ->get(); } diff --git a/database/install.sql b/database/install.sql index f9007a93..090adf6e 100644 --- a/database/install.sql +++ b/database/install.sql @@ -152,6 +152,7 @@ CREATE TABLE `v2_server` ( `tags` varchar(255) DEFAULT NULL, `rate` varchar(11) NOT NULL, `network` text NOT NULL, + `alter_id` int(11) NOT NULL DEFAULT '1', `settings` text, `rules` text, `networkSettings` text, @@ -296,8 +297,6 @@ CREATE TABLE `v2_user` ( `last_login_at` int(11) DEFAULT NULL, `last_login_ip` int(11) DEFAULT NULL, `uuid` varchar(36) NOT NULL, - `v2ray_alter_id` tinyint(4) NOT NULL DEFAULT '2', - `v2ray_level` tinyint(4) NOT NULL DEFAULT '0', `group_id` int(11) DEFAULT NULL, `plan_id` int(11) DEFAULT NULL, `remind_expire` tinyint(4) DEFAULT '1', @@ -311,4 +310,4 @@ CREATE TABLE `v2_user` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- 2020-11-17 08:48:00 +-- 2020-11-17 10:46:49 diff --git a/database/update.sql b/database/update.sql index c4442820..2a5c2997 100644 --- a/database/update.sql +++ b/database/update.sql @@ -345,3 +345,10 @@ ADD `coupon_id` int(11) NULL AFTER `plan_id`; ALTER TABLE `v2_server_stat` ADD `method` varchar(255) NOT NULL AFTER `server_id`; + +ALTER TABLE `v2_server` +ADD `alter_id` int(11) NOT NULL DEFAULT '1' AFTER `network`; + +ALTER TABLE `v2_user` +DROP `v2ray_alter_id`, +DROP `v2ray_level`;