From 39963d0edb65bab1106611600de150e5a54ec04c Mon Sep 17 00:00:00 2001 From: weizong song Date: Thu, 29 Jun 2023 09:21:30 +0800 Subject: [PATCH] up --- app/Http/Controllers/Manager/StatisticsController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Manager/StatisticsController.php b/app/Http/Controllers/Manager/StatisticsController.php index 05d6d5f..bd9666b 100644 --- a/app/Http/Controllers/Manager/StatisticsController.php +++ b/app/Http/Controllers/Manager/StatisticsController.php @@ -251,10 +251,13 @@ class StatisticsController extends CommonController $refund = $model_refund->sum("money"); $refund_by_payment = $model_refund->select("payment", "paid_at", "money", "order_id")->addSelect(DB::raw("sum(`money`) as total"))->groupBy("payment")->get()->keyBy("payment")->toArray(); - // dd($refund_by_payment); $refund_methods = (new Refund())->groupBy("payment")->get()->keyBy("payment")->toArray(); foreach ($refund_methods as $k => $refund_method) { - $refund_by_methods[$k] = $model_refund->where("payment", $k)->sum("money"); + if (isset($refund_by_payment[$k])) { + $refund_by_methods[$k] = $refund_by_payment[$k]["total"]; + } else { + $refund_by_methods[$k] = 0; + } } $payment_methods = (new Recharge())->payment_methods;