mirror of
https://github.com/v2board/v2board.git
synced 2025-01-09 23:59:11 +08:00
update: user statistical
This commit is contained in:
parent
c6fbb89452
commit
3b1159187f
@ -4,6 +4,7 @@ namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\StatUser;
|
||||
use App\Services\StatisticalService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@ -11,7 +12,10 @@ class StatController extends Controller
|
||||
{
|
||||
public function getTrafficLog(Request $request)
|
||||
{
|
||||
$builder = StatUser::select([
|
||||
$statService = new StatisticalService();
|
||||
$statService->setStartAt(strtotime(date('Y-m-d')));
|
||||
$statService->setUserStats();
|
||||
$stats = StatUser::select([
|
||||
'u',
|
||||
'd',
|
||||
'record_at',
|
||||
@ -20,9 +24,17 @@ class StatController extends Controller
|
||||
])
|
||||
->where('user_id', $request->user['id'])
|
||||
->where('record_at', '>=', strtotime(date('Y-m-1')))
|
||||
->orderBy('record_at', 'DESC');
|
||||
->orderBy('record_at', 'DESC')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
$stats = array_merge($stats, $statService->getStatUserByUserID($request->user['id']));
|
||||
usort($stats, function ($a, $b) {
|
||||
return $b['record_at'] - $a['record_at'];
|
||||
});
|
||||
|
||||
return response([
|
||||
'data' => $builder->get()
|
||||
'data' => $stats
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Library;
|
||||
|
||||
|
||||
class V2ray
|
||||
{
|
||||
protected $config;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = new \StdClass();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user