From 7f0a0a52c24c63b1853213508496a2f0ad9975df Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 9 Sep 2020 17:03:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/UserService.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Service/v3/Implementations/UserService.php b/app/Service/v3/Implementations/UserService.php index 3ae467a..77cd6f2 100644 --- a/app/Service/v3/Implementations/UserService.php +++ b/app/Service/v3/Implementations/UserService.php @@ -35,12 +35,13 @@ class UserService implements UserServiceInterface public function isStoreFirstOrderToday($user_id, $store_id, $current_order_id, $limit_amount = 3) { return !Order::query() - ->where(['user_id' => $user_id, 'store_id' => $store_id, 'type' => OrderType::OFFLINE]) - ->whereIn('state', OrderState::FINISH) - ->where('time_add', '>=', date('Y-m-d 00:00:00')) - ->where('time_add', '<=', date('Y-m-d 23:59:59')) - ->where('money', '>=', $limit_amount) - ->where('id', '!=', $current_order_id) + ->join('lanzu_order_main as main', 'main.id', '=', 'lanzu_order.order_main_id') + ->where(['main.user_id' => $user_id, 'order.store_id' => $store_id, 'main.type' => OrderType::OFFLINE]) + ->whereIn('main.state', OrderState::FINISH) + ->where('order.created_at', '>=', strtotime(date('Y-m-d 00:00:00'))) + ->where('order.created_at', '<=', strtotime(date('Y-m-d 23:59:59'))) + ->where('main.money', '>=', $limit_amount) + ->where('order.id', '!=', $current_order_id) ->exists(); } From 8a2465ae7446e9495a3f1a84560670b14d9bf10e Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 9 Sep 2020 17:09:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=BD=93=E9=9D=A2=E4=BB=98=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/UserService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Service/v3/Implementations/UserService.php b/app/Service/v3/Implementations/UserService.php index 77cd6f2..e02b9de 100644 --- a/app/Service/v3/Implementations/UserService.php +++ b/app/Service/v3/Implementations/UserService.php @@ -36,12 +36,12 @@ class UserService implements UserServiceInterface { return !Order::query() ->join('lanzu_order_main as main', 'main.id', '=', 'lanzu_order.order_main_id') - ->where(['main.user_id' => $user_id, 'order.store_id' => $store_id, 'main.type' => OrderType::OFFLINE]) + ->where(['main.user_id' => $user_id, 'lanzu_order.store_id' => $store_id, 'main.type' => OrderType::OFFLINE]) ->whereIn('main.state', OrderState::FINISH) - ->where('order.created_at', '>=', strtotime(date('Y-m-d 00:00:00'))) - ->where('order.created_at', '<=', strtotime(date('Y-m-d 23:59:59'))) + ->where('lanzu_order.created_at', '>=', strtotime(date('Y-m-d 00:00:00'))) + ->where('lanzu_order.created_at', '<=', strtotime(date('Y-m-d 23:59:59'))) ->where('main.money', '>=', $limit_amount) - ->where('order.id', '!=', $current_order_id) + ->where('lanzu_order.id', '!=', $current_order_id) ->exists(); }