diff --git a/app/common/dao/store/StoreActivityUserDao.php b/app/common/dao/store/StoreActivityUserDao.php index 0c1dbd03..ad7735c3 100755 --- a/app/common/dao/store/StoreActivityUserDao.php +++ b/app/common/dao/store/StoreActivityUserDao.php @@ -130,11 +130,14 @@ class StoreActivityUserDao extends BaseDao $userInfo = User::where('spread_uid', $userId)->field('uid,nickname,avatar')->select()->toArray(); $storeConsumptionUserDao = new StoreConsumptionUserDao(); $scope = $storeConsumptionUserDao->getScope($consumption, $myOrder['pay_price']); + // 订单有效金额为实付金额+红包金额 + $orderValidAmount = bcadd($myOrder['pay_price'], $myOrder['red_pack'], 2); + $orderValidAmount = min($orderValidAmount, $storeConsumptionUserDao->maxAmount); $orderQuery = StoreActivityOrder::where('spread_id', $userId) ->whereIn('user_id', array_column($userInfo, 'uid')) ->where('activity_id', $activityId) ->where('is_first_order', StoreActivityOrder::IS_FIRST_ORDER) - ->where('pay_price', '>=', $scope['start']); + ->where('pay_price', '>=', $orderValidAmount); if (!empty($groupOrderIds)) { unset($groupOrderIds[0]); $orderQuery->whereIn('group_order_id', $groupOrderIds); @@ -144,7 +147,7 @@ class StoreActivityUserDao extends BaseDao $orders = $orderQuery->select()->toArray(); $orders = reset_index($orders, 'user_id'); foreach ($userInfo as &$user) { - $user['target_amount'] = $scope['start']; + $user['target_amount'] = $orderValidAmount; $user['is_finish'] = isset($orders[$user['uid']]) ? 1 : 0; } return ['target' => $scope['num'], 'allow_receive' => count($orders) >= $scope['num'], 'user_info' => $userInfo];