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()