|
@@ -24,17 +24,21 @@ class Home extends Controller
|
|
|
|
|
|
|
|
$start = request()->input('start_date');
|
|
$start = request()->input('start_date');
|
|
|
$end = request()->input('end_date');
|
|
$end = request()->input('end_date');
|
|
|
- if(empty($end))$end = date('Y-m-d');
|
|
|
|
|
- if(empty($start))$start = date('Y-m-d');
|
|
|
|
|
|
|
+ if (empty($end)) $end = date('Y-m-d');
|
|
|
|
|
+ if (empty($start)) $start = date('Y-m-d');
|
|
|
|
|
|
|
|
|
|
|
|
|
$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();
|
|
|
-
|
|
|
|
|
- $params['type'] = 2;
|
|
|
|
|
- $where = PaymentOrderService::getWhere($params);
|
|
|
|
|
- $query->where($where)->whereBetween('created_at', [$start, $end]);
|
|
|
|
|
|
|
+ $query->where('type', 2)->whereBetween('created_at', [$start, $end]);
|
|
|
$query1 = clone $query;
|
|
$query1 = clone $query;
|
|
|
|
|
+ $sql = $query1->toSql();
|
|
|
|
|
+ $bindings = $query1->getBindings();
|
|
|
|
|
+ // 将绑定的参数替换到 SQL 查询中
|
|
|
|
|
+ foreach ($bindings as $binding) {
|
|
|
|
|
+ // 使用 ? 替换成绑定的值
|
|
|
|
|
+ $sql = preg_replace('/\?/', "'" . addslashes($binding) . "'", $sql, 1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
$totalAmount = (float)$query1->sum('amount');
|
|
$totalAmount = (float)$query1->sum('amount');
|
|
|
$query1 = clone $query;
|
|
$query1 = clone $query;
|
|
@@ -49,8 +53,8 @@ class Home extends Controller
|
|
|
$query1 = clone $query;
|
|
$query1 = clone $query;
|
|
|
$usdTotalSuccess = (float)$query1->where('status', 1)->sum('amount');
|
|
$usdTotalSuccess = (float)$query1->where('status', 1)->sum('amount');
|
|
|
$query1 = clone $query;
|
|
$query1 = clone $query;
|
|
|
- $usdTotalFail = (float)$query1->where('status', 2)
|
|
|
|
|
- ->sum('amount');
|
|
|
|
|
|
|
+ $usdTotalFail = (float)$query1->where('status', 2)->sum('amount');
|
|
|
|
|
+
|
|
|
$result = [
|
|
$result = [
|
|
|
'withdraw_usdt' => [
|
|
'withdraw_usdt' => [
|
|
|
'total_fail' => $usdTotalFail,
|
|
'total_fail' => $usdTotalFail,
|
|
@@ -61,6 +65,7 @@ class Home extends Controller
|
|
|
'total_fail' => $totalFail,
|
|
'total_fail' => $totalFail,
|
|
|
'total_success' => $totalSuccess,
|
|
'total_success' => $totalSuccess,
|
|
|
'total_amount' => $totalAmount,
|
|
'total_amount' => $totalAmount,
|
|
|
|
|
+ '$sql'=>$sql
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
];
|
|
];
|