2020-02-28 01:03:05 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
|
|
|
|
class ServerService
|
|
|
|
{
|
|
|
|
public function getAvailableUsers($groupId)
|
|
|
|
{
|
|
|
|
return User::whereIn('group_id', $groupId)
|
|
|
|
->whereRaw('u + d < transfer_enable')
|
|
|
|
->where(function ($query) {
|
|
|
|
$query->where('expired_at', '>=', time())
|
2020-03-01 23:29:49 +08:00
|
|
|
->orWhere('expired_at', NULL);
|
2020-02-28 01:03:05 +08:00
|
|
|
})
|
2020-03-02 20:29:17 +08:00
|
|
|
->where('banned', 1)
|
2020-02-28 01:03:05 +08:00
|
|
|
->select([
|
|
|
|
'id',
|
|
|
|
'email',
|
|
|
|
't',
|
|
|
|
'u',
|
|
|
|
'd',
|
|
|
|
'transfer_enable',
|
|
|
|
'v2ray_uuid',
|
|
|
|
'v2ray_alter_id',
|
|
|
|
'v2ray_level'
|
|
|
|
])
|
|
|
|
->get();
|
|
|
|
}
|
|
|
|
}
|