From 0e86c51eb5f1d4c394132de81a074aa866a4801d Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Mon, 1 Jul 2024 13:49:56 +0800 Subject: [PATCH] update --- app/Http/Controllers/Admin/StatisticsController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Admin/StatisticsController.php b/app/Http/Controllers/Admin/StatisticsController.php index 656eed1..f642462 100755 --- a/app/Http/Controllers/Admin/StatisticsController.php +++ b/app/Http/Controllers/Admin/StatisticsController.php @@ -553,10 +553,10 @@ class StatisticsController extends CommonController foreach ($areaList as $item) { $beds = Bed::where('area_id', $item->id)->where('project_id', $project_id)->get(); // 订单总数 - $orderTotal = OrderItems::where('created_at', 'like', '%' . $month . '%') - ->whereIn('bed_id', $beds->pluck('id')) - ->whereNotNull('paid_at') - ->sum('total'); + $orderTotal = Balance::where('created_at', 'like', '%' . $month . '%') + ->whereHas("order", function ($query) use ($project_id) { + $query->where("project_id", $project_id); + })->sum("money"); $item->order_total = $orderTotal; $item->shouxufei = round($orderTotal * 0.006, 2); $item->zengshishui = round($orderTotal * 0.06, 2);