Ken 5 дней назад
Родитель
Сommit
16496779ed
1 измененных файлов с 20 добавлено и 2 удалено
  1. 20 2
      app/Http/Controllers/admin/Home.php

+ 20 - 2
app/Http/Controllers/admin/Home.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\admin;
 use App\Constants\HttpStatus;
 use App\Http\Controllers\Controller;
 use App\Models\PaymentOrder;
+use App\Models\Recharge;
 use App\Services\PaymentOrderService;
 use Illuminate\Validation\ValidationException;
 use Exception;
@@ -47,9 +48,26 @@ class Home extends Controller
             $query1 = clone $query;
             $usdTotalFail = (float)$query1->where('status', 2)->sum('amount');
 
+
+            $query = Recharge::query();
+            $query->whereBetween('created_at', [$start, $end]);
+            $query1 = clone $query;
+            $rechargeTotalAmount = (float)$query1->sum('amount');
+            $query1 = clone $query;
+            $rechargeTotalSuccess = (float)$query1->where('status', 1)->sum('amount');
+            $query1 = clone $query;
+            $rechargeTotalFail = (float)$query1->where('status', 2)->sum('amount');
+
             $result = [
-                'start'=>$start,
-                'end'=>$end,
+                'start' => $start,
+                'end' => $end,
+                'recharge' => [
+                    'total_amount' => $rechargeTotalAmount,
+                    'total_success' => $rechargeTotalSuccess,
+                    'total_fail' => $rechargeTotalFail,
+                ],
+
+
                 'withdraw_usdt' => [
                     'total_fail' => $usdTotalFail,
                     'total_success' => $usdTotalSuccess,