update: subscribe info

This commit is contained in:
v2board 2023-05-22 00:34:24 +08:00
parent 45fd04137b
commit 4dc6d29076

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\Client;
use App\Http\Controllers\Client\Protocols\General;
use App\Http\Controllers\Controller;
use App\Services\ServerService;
use App\Utils\Helper;
use Illuminate\Http\Request;
use App\Services\UserService;
@ -40,9 +41,9 @@ class ClientController extends Controller
{
if (!isset($servers[0])) return;
if (!(int)config('v2board.show_info_to_server_enable', 0)) return;
$useTraffic = round($user['u'] / (1024*1024*1024), 2) + round($user['d'] / (1024*1024*1024), 2);
$totalTraffic = round($user['transfer_enable'] / (1024*1024*1024), 2);
$remainingTraffic = $totalTraffic - $useTraffic;
$useTraffic = $user['u'] + $user['d'];
$totalTraffic = $user['transfer_enable'];
$remainingTraffic = Helper::trafficConvert($totalTraffic - $useTraffic);
$expiredDate = $user['expired_at'] ? date('Y-m-d', $user['expired_at']) : '长期有效';
$userService = new UserService();
$resetDay = $userService->getResetDay($user);
@ -55,7 +56,7 @@ class ClientController extends Controller
]));
}
array_unshift($servers, array_merge($servers[0], [
'name' => "剩余流量:{$remainingTraffic} GB",
'name' => "剩余流量:{$remainingTraffic}",
]));
}
}