mirror of
https://github.com/v2board/v2board.git
synced 2025-06-16 06:37:53 +08:00
update: fix statistics
This commit is contained in:
@ -82,18 +82,12 @@ class DeepbworkController extends Controller
|
||||
Cache::put(CacheKey::get('SERVER_VMESS_ONLINE_USER', $server->id), count($data), 3600);
|
||||
Cache::put(CacheKey::get('SERVER_VMESS_LAST_PUSH_AT', $server->id), time(), 3600);
|
||||
$userService = new UserService();
|
||||
$statData = [];
|
||||
foreach ($data as $item) {
|
||||
$u = $item['u'];
|
||||
$d = $item['d'];
|
||||
$userService->trafficFetch($u, $d, $item['user_id'], $server->toArray(), 'vmess');
|
||||
$statData[$item['user_id']] = [$u, $d];
|
||||
}
|
||||
$formatData = [];
|
||||
|
||||
$statService = new StatisticalService();
|
||||
$statService->setStartAt(strtotime(date('Y-m-d')));
|
||||
$statService->setUserStats();
|
||||
$statService->statUser($server['rate'], $statData);
|
||||
foreach ($data as $item) {
|
||||
$formatData[$item['user_id']] = [$item['u'], $item['d']];
|
||||
}
|
||||
$userService->trafficFetch($server->toArray(), 'vmess', $formatData);
|
||||
|
||||
return response([
|
||||
'ret' => 1,
|
||||
|
@ -74,18 +74,12 @@ class ShadowsocksTidalabController extends Controller
|
||||
Cache::put(CacheKey::get('SERVER_SHADOWSOCKS_ONLINE_USER', $server->id), count($data), 3600);
|
||||
Cache::put(CacheKey::get('SERVER_SHADOWSOCKS_LAST_PUSH_AT', $server->id), time(), 3600);
|
||||
$userService = new UserService();
|
||||
$statData = [];
|
||||
foreach ($data as $item) {
|
||||
$u = $item['u'];
|
||||
$d = $item['d'];
|
||||
$userService->trafficFetch($u, $d, $item['user_id'], $server->toArray(), 'shadowsocks');
|
||||
$statData[$item['user_id']] = [$u, $d];
|
||||
}
|
||||
$formatData = [];
|
||||
|
||||
$statService = new StatisticalService();
|
||||
$statService->setStartAt(strtotime(date('Y-m-d')));
|
||||
$statService->setUserStats();
|
||||
$statService->statUser($server['rate'], $statData);
|
||||
foreach ($data as $item) {
|
||||
$formatData[$item['user_id']] = [$item['u'], $item['d']];
|
||||
}
|
||||
$userService->trafficFetch($server->toArray(), 'shadowsocks', $formatData);
|
||||
|
||||
return response([
|
||||
'ret' => 1,
|
||||
|
@ -79,18 +79,11 @@ class TrojanTidalabController extends Controller
|
||||
Cache::put(CacheKey::get('SERVER_TROJAN_ONLINE_USER', $server->id), count($data), 3600);
|
||||
Cache::put(CacheKey::get('SERVER_TROJAN_LAST_PUSH_AT', $server->id), time(), 3600);
|
||||
$userService = new UserService();
|
||||
$statData = [];
|
||||
$formatData = [];
|
||||
foreach ($data as $item) {
|
||||
$u = $item['u'];
|
||||
$d = $item['d'];
|
||||
$userService->trafficFetch($u, $d, $item['user_id'], $server->toArray(), 'trojan');
|
||||
$statData[$item['user_id']] = [$u, $d];
|
||||
$formatData[$item['user_id']] = [$item['u'], $item['d']];
|
||||
}
|
||||
|
||||
$statService = new StatisticalService();
|
||||
$statService->setStartAt(strtotime(date('Y-m-d')));
|
||||
$statService->setUserStats();
|
||||
$statService->statUser($server['rate'], $statData);
|
||||
$userService->trafficFetch($server->toArray(), 'trojan', $formatData);
|
||||
|
||||
return response([
|
||||
'ret' => 1,
|
||||
|
@ -64,18 +64,7 @@ class UniProxyController extends Controller
|
||||
Cache::put(CacheKey::get('SERVER_' . strtoupper($this->nodeType) . '_ONLINE_USER', $this->nodeInfo->id), count($data), 3600);
|
||||
Cache::put(CacheKey::get('SERVER_' . strtoupper($this->nodeType) . '_LAST_PUSH_AT', $this->nodeInfo->id), time(), 3600);
|
||||
$userService = new UserService();
|
||||
foreach (array_keys($data) as $k) {
|
||||
$u = $data[$k][0];
|
||||
$d = $data[$k][1];
|
||||
$userService->trafficFetch($u, $d, $k, $this->nodeInfo->toArray(), $this->nodeType);
|
||||
}
|
||||
|
||||
$statService = new StatisticalService();
|
||||
$statService->setStartAt(strtotime(date('Y-m-d')));
|
||||
$statService->setUserStats();
|
||||
$statService->statUser($this->nodeInfo->rate, $data);
|
||||
$statService->setServerStats();
|
||||
$statService->statServer($this->nodeId, $this->nodeType, $data);
|
||||
$userService->trafficFetch($this->nodeInfo->toArray(), $this->nodeType, $data);
|
||||
|
||||
return response([
|
||||
'data' => true
|
||||
|
Reference in New Issue
Block a user