Ken 1 vecka sedan
förälder
incheckning
bf723b15a1
1 ändrade filer med 11 tillägg och 4 borttagningar
  1. 11 4
      app/Http/Controllers/admin/Home.php

+ 11 - 4
app/Http/Controllers/admin/Home.php

@@ -33,18 +33,25 @@ class Home extends Controller
 
 
             $query = Withdraw::query();
             $query = Withdraw::query();
             $usdTotalAmount = (float)$query->whereBetween('created_at', [$start, $end])->sum('amount');
             $usdTotalAmount = (float)$query->whereBetween('created_at', [$start, $end])->sum('amount');
-            $usdTotalSuccess = (float)$query->whereBetween('created_at', [$start, $end])->where('status',1)->sum('amount');
-            $usdTotalFail = $query->whereBetween('created_at', [$start, $end])->where('status',2)
+            $usdTotalSuccess = (float)$query->whereBetween('created_at', [$start, $end])->where('status', 1)->sum('amount');
+            $usdTotalFail = (float)$query->whereBetween('created_at', [$start, $end])->where('status', 2)
+                ->sum('amount');
+            $sql = $query->whereBetween('created_at', [$start, $end])->where('status', 2)->toSql();
 
 
+            $bindings = $query->getBindings();
 
 
-//                ->sum('amount')
-                ->toSql();
+// 将绑定的参数替换到 SQL 查询中
+            foreach ($bindings as $binding) {
+                // 使用 ? 替换成绑定的值
+                $sql = preg_replace('/\?/', "'" . addslashes($binding) . "'", $sql, 1);
+            }
 
 
             $result = [
             $result = [
                 'withdraw_usdt' => [
                 'withdraw_usdt' => [
                     'total_fail' => $usdTotalFail,
                     'total_fail' => $usdTotalFail,
                     'total_success' => $usdTotalSuccess,
                     'total_success' => $usdTotalSuccess,
                     'total_amount' => $usdTotalAmount,
                     'total_amount' => $usdTotalAmount,
+                    'sql'=>$sql
                 ],
                 ],
                 'withdraw_rmb' => [
                 'withdraw_rmb' => [
                     'total_fail' => $totalFail,
                     'total_fail' => $totalFail,