diff --git a/app/Services/ServerService.php b/app/Services/ServerService.php index 363cca1..807ca38 100644 --- a/app/Services/ServerService.php +++ b/app/Services/ServerService.php @@ -163,7 +163,8 @@ class ServerService public function getAvailableUsers($groupId) { - return User::whereIn('group_id', $groupId) + return \DB::table('v2_user') + ->whereIn('group_id', $groupId) ->whereRaw('u + d < transfer_enable') ->where(function ($query) { $query->where('expired_at', '>=', time()) diff --git a/database/migrations/2023_12_12_212239_add_index_to_v2_user_table.php b/database/migrations/2023_12_12_212239_add_index_to_v2_user_table.php new file mode 100644 index 0000000..b06cbd3 --- /dev/null +++ b/database/migrations/2023_12_12_212239_add_index_to_v2_user_table.php @@ -0,0 +1,28 @@ +index(['u','d','expired_at','group_id','banned','transfer_enable']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('v2_user', function (Blueprint $table) { + $table->dropIndex(['u','d','expired_at','group_id','banned','transfer_enable']); + }); + } +};