mirror of
https://github.com/v2board/v2board.git
synced 2025-01-11 00:29:09 +08:00
update: custom show more info to server subscribe
This commit is contained in:
parent
da2f942a28
commit
b24041cc23
@ -116,6 +116,7 @@ class ConfigController extends Controller
|
|||||||
'new_order_event_id' => (int)config('v2board.new_order_event_id', 0),
|
'new_order_event_id' => (int)config('v2board.new_order_event_id', 0),
|
||||||
'renew_order_event_id' => (int)config('v2board.renew_order_event_id', 0),
|
'renew_order_event_id' => (int)config('v2board.renew_order_event_id', 0),
|
||||||
'change_order_event_id' => (int)config('v2board.change_order_event_id', 0),
|
'change_order_event_id' => (int)config('v2board.change_order_event_id', 0),
|
||||||
|
'show_info_to_server_enable' => (int)config('v2board.show_info_to_server_enable', 0)
|
||||||
],
|
],
|
||||||
'frontend' => [
|
'frontend' => [
|
||||||
'frontend_theme' => config('v2board.frontend_theme', 'v2board'),
|
'frontend_theme' => config('v2board.frontend_theme', 'v2board'),
|
||||||
|
@ -23,6 +23,7 @@ class ClientController extends Controller
|
|||||||
if ($userService->isAvailable($user)) {
|
if ($userService->isAvailable($user)) {
|
||||||
$serverService = new ServerService();
|
$serverService = new ServerService();
|
||||||
$servers = $serverService->getAvailableServers($user);
|
$servers = $serverService->getAvailableServers($user);
|
||||||
|
$this->setSubscribeInfoToServers($servers, $user);
|
||||||
if ($flag) {
|
if ($flag) {
|
||||||
foreach (glob(app_path('Http//Controllers//Client//Protocols') . '/*.php') as $file) {
|
foreach (glob(app_path('Http//Controllers//Client//Protocols') . '/*.php') as $file) {
|
||||||
$file = 'App\\Http\\Controllers\\Client\\Protocols\\' . basename($file, '.php');
|
$file = 'App\\Http\\Controllers\\Client\\Protocols\\' . basename($file, '.php');
|
||||||
@ -38,4 +39,26 @@ class ClientController extends Controller
|
|||||||
die('该客户端暂不支持进行订阅');
|
die('该客户端暂不支持进行订阅');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setSubscribeInfoToServers(&$servers, $user)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
$expiredDate = $user['expired_at'] ? date('Y-m-d', $user['expired_at']) : '长期有效';
|
||||||
|
$userService = new UserService();
|
||||||
|
$resetDay = $userService->getResetDay($user);
|
||||||
|
array_unshift($servers, array_merge($servers[0], [
|
||||||
|
'name' => "套餐到期:{$expiredDate}",
|
||||||
|
]));
|
||||||
|
if ($resetDay) {
|
||||||
|
array_unshift($servers, array_merge($servers[0], [
|
||||||
|
'name' => "距离下次重置剩余:{$resetDay} 天",
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
array_unshift($servers, array_merge($servers[0], [
|
||||||
|
'name' => "剩余流量:{$remainingTraffic} GB",
|
||||||
|
]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ class ConfigSave extends FormRequest
|
|||||||
'new_order_event_id' => 'in:0,1',
|
'new_order_event_id' => 'in:0,1',
|
||||||
'renew_order_event_id' => 'in:0,1',
|
'renew_order_event_id' => 'in:0,1',
|
||||||
'change_order_event_id' => 'in:0,1',
|
'change_order_event_id' => 'in:0,1',
|
||||||
|
'show_info_to_server_enable' => 'in:0,1',
|
||||||
// server
|
// server
|
||||||
'server_token' => 'nullable|min:16',
|
'server_token' => 'nullable|min:16',
|
||||||
'server_license' => 'nullable',
|
'server_license' => 'nullable',
|
||||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
2
public/theme/v2board/assets/umi.js
vendored
2
public/theme/v2board/assets/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user