2019-12-18 18:08:52 +08:00
|
|
|
<?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;
|
2020-01-12 01:27:36 +08:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
2019-12-18 18:08:52 +08:00
|
|
|
|
2019-12-23 18:46:37 +08:00
|
|
|
class StatController extends Controller
|
2019-12-18 18:08:52 +08:00
|
|
|
{
|
2020-01-11 13:36:52 +08:00
|
|
|
public function getOverride(Request $request)
|
|
|
|
{
|
2019-12-18 18:08:52 +08:00
|
|
|
return response([
|
|
|
|
'data' => [
|
2020-01-20 13:57:30 +08:00
|
|
|
'month_income' => Order::where('created_at', '>=', strtotime(date('Y-m-1')))
|
|
|
|
->where('created_at', '<', time())
|
2020-06-01 01:02:45 +08:00
|
|
|
->whereIn('status', [3, 4])
|
2020-01-20 13:57:30 +08:00
|
|
|
->sum('total_amount'),
|
|
|
|
'month_register_total' => User::where('created_at', '>=', strtotime(date('Y-m-1')))
|
|
|
|
->where('created_at', '<', time())
|
|
|
|
->count(),
|
2019-12-18 18:08:52 +08:00
|
|
|
'ticket_pendding_total' => Ticket::where('status', 0)
|
|
|
|
->count(),
|
|
|
|
'commission_pendding_total' => Order::where('commission_status', 0)
|
2019-12-18 18:14:26 +08:00
|
|
|
->where('invite_user_id', '!=', NULL)
|
2020-11-02 22:22:18 +08:00
|
|
|
->where('status', [3, 4])
|
2020-05-26 15:46:44 +08:00
|
|
|
->where('commission_balance', '>', 0)
|
2019-12-18 18:08:52 +08:00
|
|
|
->count(),
|
2020-05-10 23:09:22 +08:00
|
|
|
'day_income' => Order::where('created_at', '>=', strtotime(date('Y-m-d')))
|
|
|
|
->where('created_at', '<', time())
|
2020-11-17 16:40:13 +08:00
|
|
|
->whereIn('status', [3, 4])
|
2020-05-10 23:09:22 +08:00
|
|
|
->sum('total_amount'),
|
|
|
|
'last_month_income' => Order::where('created_at', '>=', strtotime('-1 month', strtotime(date('Y-m-1'))))
|
|
|
|
->where('created_at', '<', strtotime(date('Y-m-1')))
|
2020-11-17 16:40:13 +08:00
|
|
|
->whereIn('status', [3, 4])
|
2020-05-10 23:09:22 +08:00
|
|
|
->sum('total_amount')
|
2019-12-18 18:08:52 +08:00
|
|
|
]
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|