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