From e4b76a705f71a1fc9b70088ae0d7cda6e5956ced Mon Sep 17 00:00:00 2001 From: tokumeikoi Date: Sat, 13 Mar 2021 01:03:53 +0900 Subject: [PATCH] fix: stat --- app/Console/Commands/CheckCommission.php | 2 +- app/Console/Commands/V2boardStatistics.php | 2 +- app/Http/Controllers/Admin/OrderController.php | 2 +- app/Http/Controllers/Admin/StatController.php | 8 ++++---- app/Services/OrderService.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Console/Commands/CheckCommission.php b/app/Console/Commands/CheckCommission.php index c9fe19be..4ff2de70 100644 --- a/app/Console/Commands/CheckCommission.php +++ b/app/Console/Commands/CheckCommission.php @@ -49,7 +49,7 @@ class CheckCommission extends Command if ((int)config('v2board.commission_auto_check_enable', 1)) { Order::where('commission_status', 0) ->where('invite_user_id', '!=', NULL) - ->whereIn('status', '!=', [0, 2]) + ->whereNotIn('status', [0, 2]) ->where('updated_at', '<=', strtotime('-3 day', time())) ->update([ 'commission_status' => 1 diff --git a/app/Console/Commands/V2boardStatistics.php b/app/Console/Commands/V2boardStatistics.php index 0dcd3ae7..ce37da90 100644 --- a/app/Console/Commands/V2boardStatistics.php +++ b/app/Console/Commands/V2boardStatistics.php @@ -52,7 +52,7 @@ class V2BoardStatistics extends Command $startAt = strtotime('-1 day', $endAt); $builder = Order::where('created_at', '>=', $startAt) ->where('created_at', '<', $endAt) - ->whereIn('status', '!=', [0, 2]); + ->whereNotIn('status', [0, 2]); $orderCount = $builder->count(); $orderAmount = $builder->sum('total_amount'); $builder = $builder->where('commission_balance', '!=', 0) diff --git a/app/Http/Controllers/Admin/OrderController.php b/app/Http/Controllers/Admin/OrderController.php index b9d5546a..2bfd6105 100644 --- a/app/Http/Controllers/Admin/OrderController.php +++ b/app/Http/Controllers/Admin/OrderController.php @@ -25,7 +25,7 @@ class OrderController extends Controller } if ($request->input('is_commission')) { $orderModel->where('invite_user_id', '!=', NULL); - $orderModel->whereIn('status', '!=', [0, 2]); + $orderModel->whereNotIn('status', [0, 2]); $orderModel->where('commission_balance', '>', 0); } if ($request->input('id')) { diff --git a/app/Http/Controllers/Admin/StatController.php b/app/Http/Controllers/Admin/StatController.php index df15a37a..f093d00e 100644 --- a/app/Http/Controllers/Admin/StatController.php +++ b/app/Http/Controllers/Admin/StatController.php @@ -26,7 +26,7 @@ class StatController extends Controller 'data' => [ 'month_income' => Order::where('created_at', '>=', strtotime(date('Y-m-1'))) ->where('created_at', '<', time()) - ->whereIn('status', '!=', [0, 2]) + ->whereNotIn('status', [0, 2]) ->sum('total_amount'), 'month_register_total' => User::where('created_at', '>=', strtotime(date('Y-m-1'))) ->where('created_at', '<', time()) @@ -35,16 +35,16 @@ class StatController extends Controller ->count(), 'commission_pendding_total' => Order::where('commission_status', 0) ->where('invite_user_id', '!=', NULL) - ->whereIn('status', '!=', [0, 2]) + ->whereNotIn('status', [0, 2]) ->where('commission_balance', '>', 0) ->count(), 'day_income' => Order::where('created_at', '>=', strtotime(date('Y-m-d'))) ->where('created_at', '<', time()) - ->whereIn('status', '!=', [0, 2]) + ->whereNotIn('status', [0, 2]) ->sum('total_amount'), 'last_month_income' => Order::where('created_at', '>=', strtotime('-1 month', strtotime(date('Y-m-1')))) ->where('created_at', '<', strtotime(date('Y-m-1'))) - ->whereIn('status', '!=', [0, 2]) + ->whereNotIn('status', [0, 2]) ->sum('total_amount') ] ]); diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 53597f70..dcacd766 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -141,7 +141,7 @@ class OrderService private function haveValidOrder(User $user) { return Order::where('user_id', $user->id) - ->whereIn('status', '!=', [0, 2]) + ->whereNotIn('status', [0, 2]) ->first(); }