From 4c7ddfc30bf100c815c2557664147342e26d1ce8 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Fri, 5 Aug 2022 18:38:06 +0800 Subject: [PATCH] fixed dashboard --- .../Admin/Repositories/Report/OrderReportRepo.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/beike/Admin/Repositories/Report/OrderReportRepo.php b/beike/Admin/Repositories/Report/OrderReportRepo.php index ab4a7e52..1dfbdaa8 100644 --- a/beike/Admin/Repositories/Report/OrderReportRepo.php +++ b/beike/Admin/Repositories/Report/OrderReportRepo.php @@ -27,13 +27,13 @@ class OrderReportRepo public static function getLatestMonth() { $orderTotals = OrderRepo::getListBuilder(['start' => today()->subMonth(), 'end' => today()->subDay()]) - ->select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as total')) + ->select(DB::raw('DATE(created_at) as date, count(*) as total')) ->groupBy('date') ->get() ->keyBy('date'); $orderAmounts = OrderRepo::getListBuilder(['start' => today()->subMonth(), 'end' => today()->subDay()]) - ->select(DB::raw('DATE(created_at) as date'), DB::raw('sum(total) as amount')) + ->select(DB::raw('DATE(created_at) as date, sum(total) as amount')) ->groupBy('date') ->get() ->keyBy('date'); @@ -47,7 +47,7 @@ class OrderReportRepo $dates[] = $dateFormat; $totals[] = $orderTotal ? $orderTotal->total : 0; - $amounts[] = currency_format($orderAmount ? $orderAmount->amount : 0); + $amounts[] = $orderAmount ? $orderAmount->amount : 0; } $data = [ @@ -65,13 +65,13 @@ class OrderReportRepo public static function getLatestWeek() { $orderTotals = OrderRepo::getListBuilder(['start' => today()->subWeek(), 'end' => today()->subDay()]) - ->select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as total')) + ->select(DB::raw('DATE(created_at) as date, count(*) as total')) ->groupBy('date') ->get() ->keyBy('date'); $orderAmounts = OrderRepo::getListBuilder(['start' => today()->subWeek(), 'end' => today()->subDay()]) - ->select(DB::raw('DATE(created_at) as date'), DB::raw('sum(total) as amount')) + ->select(DB::raw('DATE(created_at) as date, sum(total) as amount')) ->groupBy('date') ->get() ->keyBy('date'); @@ -85,7 +85,7 @@ class OrderReportRepo $dates[] = $dateFormat; $totals[] = $orderTotal ? $orderTotal->total : 0; - $amounts[] = currency_format($orderAmount ? $orderAmount->amount : 0); + $amounts[] = $orderAmount ? $orderAmount->amount : 0; } $data = [ @@ -131,7 +131,7 @@ class OrderReportRepo $dates[] = $dateFormat; $totals[] = $orderTotal ?: 0; - $amounts[] = currency_format($orderAmount ?: 0); + $amounts[] = $orderAmount ?: 0; } $data = [