Ken 6 dni temu
rodzic
commit
9493823517
1 zmienionych plików z 19 dodań i 5 usunięć
  1. 19 5
      app/Http/Controllers/admin/Home.php

+ 19 - 5
app/Http/Controllers/admin/Home.php

@@ -31,13 +31,22 @@ class Home extends Controller
 
 
             $end = Carbon::createFromFormat('Y-m-d', $end)->addDay()->format('Y-m-d');
             $end = Carbon::createFromFormat('Y-m-d', $end)->addDay()->format('Y-m-d');
             $query = PaymentOrder::query();
             $query = PaymentOrder::query();
-            $query->where('type', 2)->whereBetween('created_at', [$start, $end]);
+            $query->whereBetween('created_at', [$start, $end]);
+            $query1 = clone $query;
+            $totalAmount = (float)$query1->where('type', 2)->sum('amount');
+            $query1 = clone $query;
+            $totalSuccess = (float)$query1->where('type', 2)->whereIn('status', [1, 2])->sum('amount');
+            $query1 = clone $query;
+            $totalFail = (float)$query1->where('type', 2)->where('status', 3)->sum('amount');
+
+
             $query1 = clone $query;
             $query1 = clone $query;
-            $totalAmount = (float)$query1->sum('amount');
+            $rechargeRmbTotalAmount = (float)$query1->where('type', 1)->sum('amount');
             $query1 = clone $query;
             $query1 = clone $query;
-            $totalSuccess = (float)$query1->whereIn('status', [1, 2])->sum('amount');
+            $rechargeRmbTotalSuccess = (float)$query1->where('type', 1)->whereIn('status', [1, 2])->sum('amount');
             $query1 = clone $query;
             $query1 = clone $query;
-            $totalFail = (float)$query1->where('status', 3)->sum('amount');
+            $rechargeRmbTotalFail = (float)$query1->where('type', 1)->where('status', 3)->sum('amount');
+
 
 
             $query = Withdraw::query();
             $query = Withdraw::query();
             $query->whereBetween('created_at', [$start, $end]);
             $query->whereBetween('created_at', [$start, $end]);
@@ -61,11 +70,16 @@ class Home extends Controller
             $result = [
             $result = [
                 'start' => $start,
                 'start' => $start,
                 'end' => $end,
                 'end' => $end,
-                'recharge' => [
+                'recharge_usd' => [
                     'total_amount' => $rechargeTotalAmount,
                     'total_amount' => $rechargeTotalAmount,
                     'total_success' => $rechargeTotalSuccess,
                     'total_success' => $rechargeTotalSuccess,
                     'total_fail' => $rechargeTotalFail,
                     'total_fail' => $rechargeTotalFail,
                 ],
                 ],
+                'recharge_rmb' => [
+                    'total_amount' => $rechargeRmbTotalAmount,
+                    'total_success' => $rechargeRmbTotalSuccess,
+                    'total_fail' => $rechargeRmbTotalFail,
+                ],
 
 
 
 
                 'withdraw_usdt' => [
                 'withdraw_usdt' => [