From 1434d6fa1c84ac878eb2ebe8cb5c21f1e8cadcc6 Mon Sep 17 00:00:00 2001 From: Wisp X <1591788658@qq.com> Date: Wed, 27 Apr 2022 15:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/ConsoleController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Admin/ConsoleController.php b/app/Http/Controllers/Admin/ConsoleController.php index a35ac37e..3759432e 100644 --- a/app/Http/Controllers/Admin/ConsoleController.php +++ b/app/Http/Controllers/Admin/ConsoleController.php @@ -18,10 +18,10 @@ class ConsoleController extends Controller $format = 'Y-m-d H:i:s'; $numbers = [ - 'today' => Image::query()->whereBetween('created_at', [$carbon->startOfDay()->format($format), $carbon->endOfDay()->format($format)])->count(), - 'yesterday' => Image::query()->whereBetween('created_at', [$carbon->yesterday()->startOfDay()->format($format), $carbon->yesterday()->endOfDay()->format($format)])->count(), - 'week' => Image::query()->whereBetween('created_at', [$carbon->startOfWeek()->format($format), $carbon->endOfWeek()->format($format)])->count(), - 'month' => Image::query()->whereBetween('created_at', [$carbon->startOfMonth()->format($format), $carbon->endOfMonth()->format($format)])->count(), + 'today' => Image::query()->whereBetween('created_at', [$carbon->startOfDay()->format($format), $carbon->endOfDay()->format($format)])->count('id'), + 'yesterday' => Image::query()->whereBetween('created_at', [$carbon->yesterday()->startOfDay()->format($format), $carbon->yesterday()->endOfDay()->format($format)])->count('id'), + 'week' => Image::query()->whereBetween('created_at', [$carbon->startOfWeek()->format($format), $carbon->endOfWeek()->format($format)])->count('id'), + 'month' => Image::query()->whereBetween('created_at', [$carbon->startOfMonth()->format($format), $carbon->endOfMonth()->format($format)])->count('id'), ]; $start = Carbon::now()->parse('-30 day')->startOfDay(); @@ -32,7 +32,7 @@ class ConsoleController extends Controller $images = Image::query() ->whereBetween('created_at', [$start->format($format), $end->format($format)]) - ->get() + ->get(['user_id', 'created_at']) ->transform(function (Image $image) { $image['date'] = $image->created_at->format('Y-m-d'); return $image;