diff --git a/app/Controller/NotifyController.php b/app/Controller/NotifyController.php index fb4de38..c762745 100644 --- a/app/Controller/NotifyController.php +++ b/app/Controller/NotifyController.php @@ -309,7 +309,7 @@ class NotifyController extends BaseController StoreAccount::query()->insert(array_merge($recordBase, $record)); // 平台新用户奖励给商户 - $isStageNewUser = $this->userService->isStageNewUser($orderItem['user_id']); + $isStageNewUser = $this->userService->isStageNewUser($orderItem['user_id'], $orderMain->id); $needAward = false; $awardAmount = 0; if ($isStageNewUser) { diff --git a/app/Service/UserService.php b/app/Service/UserService.php index a665734..8f43371 100644 --- a/app/Service/UserService.php +++ b/app/Service/UserService.php @@ -15,12 +15,14 @@ class UserService implements UserServiceInterface * 判定条件: * 没有在平台下过单(包括线上和线下) * @param $user_id + * @param $order_main_id * @return mixed|void */ - public function isStageNewUser($user_id): bool + public function isStageNewUser($user_id, $order_main_id): bool { $exist = OrderMain::query() ->where(['user_id' => $user_id]) + ->where('id', '!=', $order_main_id) ->where(function ($query){ $query->whereIn('state', [OrderMain::ORDER_STATE_COMPLETE,OrderMain::ORDER_STATE_EVALUATED,OrderMain::ORDER_STATE_UNREFUND]) ->orWhereIn('dm_state', [OrderMain::ORDER_STATE_UNTAKE,OrderMain::ORDER_STATE_DELIVERY]); diff --git a/app/Service/UserServiceInterface.php b/app/Service/UserServiceInterface.php index 2e41493..8742ce9 100644 --- a/app/Service/UserServiceInterface.php +++ b/app/Service/UserServiceInterface.php @@ -9,9 +9,10 @@ interface UserServiceInterface /** * 是否平台新用户 * @param $user_id + * @param $order_main_id * @return mixed */ - public function isStageNewUser($user_id): bool; + public function isStageNewUser($user_id, $order_main_id): bool; public function saveUserUnionid($openid,$unionid);