From 6bedea3a97f01a77a507e8a08d6ce1a289593462 Mon Sep 17 00:00:00 2001 From: weizong song Date: Wed, 28 Jun 2023 16:58:22 +0800 Subject: [PATCH] up --- app/Http/Controllers/Manager/StatisticsController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Manager/StatisticsController.php b/app/Http/Controllers/Manager/StatisticsController.php index e9ea1f8..b2cc581 100644 --- a/app/Http/Controllers/Manager/StatisticsController.php +++ b/app/Http/Controllers/Manager/StatisticsController.php @@ -249,6 +249,12 @@ class StatisticsController extends CommonController $checkout = $model_checkout->sum("total"); $refund = $model_refund->sum("money"); + $refund_by_methods = []; + $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"); + } + $payment_methods = (new Recharge())->payment_methods; $payment_online_methods = (new Recharge())->payment_online_methods; @@ -267,7 +273,7 @@ class StatisticsController extends CommonController $recharge[$k] = $val; } - return response()->json(compact("checkout", "refund", "recharge", "payment_methods")); + return response()->json(compact("checkout", "refund", "recharge", "payment_methods", "refund_by_methods")); } public function _getDuration()