|
|
@@ -33,18 +33,25 @@ class Home extends Controller
|
|
|
|
|
|
$query = Withdraw::query();
|
|
|
$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 = [
|
|
|
'withdraw_usdt' => [
|
|
|
'total_fail' => $usdTotalFail,
|
|
|
'total_success' => $usdTotalSuccess,
|
|
|
'total_amount' => $usdTotalAmount,
|
|
|
+ 'sql'=>$sql
|
|
|
],
|
|
|
'withdraw_rmb' => [
|
|
|
'total_fail' => $totalFail,
|