调整活动订单有效金额查询
This commit is contained in:
parent
f53d5f8f24
commit
2015422c5d
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user