mirror of
https://github.com/v2board/v2board.git
synced 2025-02-10 23:49:12 +08:00
update
This commit is contained in:
parent
34bb04d755
commit
e85fdf203a
@ -45,7 +45,6 @@ class SystemCache extends Command
|
|||||||
{
|
{
|
||||||
$this->setMonthIncome();
|
$this->setMonthIncome();
|
||||||
$this->setMonthRegisterTotal();
|
$this->setMonthRegisterTotal();
|
||||||
$this->setMonthServerTrafficTotal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setMonthIncome() {
|
private function setMonthIncome() {
|
||||||
@ -66,15 +65,4 @@ class SystemCache extends Command
|
|||||||
->count()
|
->count()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setMonthServerTrafficTotal () {
|
|
||||||
$servers = Server::get();
|
|
||||||
foreach ($servers as $item) {
|
|
||||||
$serverLog = ServerLog::where('created_at', '>=', strtotime(date('Y-m-1')))
|
|
||||||
->where('created_at', '<', time())
|
|
||||||
->where('node_id', $item->id);
|
|
||||||
Redis::set('month_server_traffic_total_u_' . $item->id, $serverLog->sum('u'));
|
|
||||||
Redis::set('month_server_traffic_total_d_' . $item->id, $serverLog->sum('d'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
33
app/Http/Controllers/Admin/DashboardController.php
Normal file
33
app/Http/Controllers/Admin/DashboardController.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\ServerGroup;
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Models\Plan;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\Ticket;
|
||||||
|
use App\Models\Order;
|
||||||
|
use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
|
class StatController extends Controller
|
||||||
|
{
|
||||||
|
public function index (Request $request) {
|
||||||
|
return response([
|
||||||
|
'data' => [
|
||||||
|
'month_income' => Redis::get('month_income'),
|
||||||
|
'month_register_total' => Redis::get('month_register_total'),
|
||||||
|
'server_offline_total' => Server::where('last_check_at', '<', time() - 300)
|
||||||
|
->count(),
|
||||||
|
'ticket_pendding_total' => Ticket::where('status', 0)
|
||||||
|
->count(),
|
||||||
|
'commission_pendding_total' => Order::where('commission_status', 0)
|
||||||
|
->where('status', 3)
|
||||||
|
->count(),
|
||||||
|
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Models\ServerGroup;
|
|
||||||
use App\Models\Server;
|
|
||||||
use App\Models\Plan;
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Support\Facades\Redis;
|
|
||||||
|
|
||||||
class StatController extends Controller
|
|
||||||
{
|
|
||||||
public function dashboard (Request $request) {
|
|
||||||
return response([
|
|
||||||
'data' => [
|
|
||||||
'month_income' => Redis::get('month_income'),
|
|
||||||
'month_register_total' => Redis::get('month_register_total')
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -43,8 +43,8 @@ Route::prefix('v1')
|
|||||||
Route::get ('user', 'Admin\\UserController@index');
|
Route::get ('user', 'Admin\\UserController@index');
|
||||||
Route::post('user/update', 'Admin\\UserController@update');
|
Route::post('user/update', 'Admin\\UserController@update');
|
||||||
Route::get ('user/id2UserInfo/{id}', 'Admin\\UserController@id2UserInfo');
|
Route::get ('user/id2UserInfo/{id}', 'Admin\\UserController@id2UserInfo');
|
||||||
// Stat
|
// Dashboard
|
||||||
Route::get ('stat/dashboard', 'Admin\\StatController@dashboard');
|
Route::get ('dashboard', 'Admin\\DashboardController@index');
|
||||||
// Notice
|
// Notice
|
||||||
Route::get ('notice', 'Admin\\NoticeController@index');
|
Route::get ('notice', 'Admin\\NoticeController@index');
|
||||||
Route::post('notice/save', 'Admin\\NoticeController@save');
|
Route::post('notice/save', 'Admin\\NoticeController@save');
|
||||||
|
Loading…
Reference in New Issue
Block a user