调整活动完成状态查询
This commit is contained in:
parent
94d3d1d95b
commit
098557151d
@ -112,9 +112,17 @@ class StoreActivityUserDao extends BaseDao
|
||||
$consumption = StoreConsumption::where('coupon_id', $activityUser['value'])
|
||||
->where('type', StoreConsumption::TYPE_PULL_CONSUMPTION)
|
||||
->find();
|
||||
$unReceiveConsumption = StoreConsumptionUser::where('uid', $userId)->where('status', StoreConsumptionUser::STATUS_UN_RECEIVE)->value('order_id_set');
|
||||
if (!empty($unReceiveConsumption)) {
|
||||
$groupOrderIds = explode(',', $unReceiveConsumption);
|
||||
$groupOrderId = $groupOrderIds[0];
|
||||
$myOrderWhere = ['group_order_id' => $groupOrderId];
|
||||
} else {
|
||||
$myOrderWhere = ['status' => StoreActivityOrder::STATUS_VALID];
|
||||
}
|
||||
$myOrder = StoreActivityOrder::where('user_id', $userId)
|
||||
->where('activity_id', $activityId)
|
||||
->where('status', StoreActivityOrder::STATUS_VALID)
|
||||
->where($myOrderWhere)
|
||||
->find();
|
||||
$userInfo = User::where('spread_uid', $userId)->field('uid,nickname,avatar')->select()->toArray();
|
||||
if (empty($myOrder) || empty($myOrder['pay_price'])) {
|
||||
@ -122,13 +130,18 @@ class StoreActivityUserDao extends BaseDao
|
||||
}
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$scope = $storeConsumptionUserDao->getScope($consumption, $myOrder['pay_price']);
|
||||
$orders = StoreActivityOrder::where('spread_id', $userId)
|
||||
$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('status', StoreActivityOrder::STATUS_VALID)
|
||||
->select()->toArray();
|
||||
->where('pay_price', '>=', $scope['start']);
|
||||
if (!empty($groupOrderIds)) {
|
||||
unset($groupOrderIds[0]);
|
||||
$orderQuery->whereIn('group_order_id', $groupOrderIds);
|
||||
} else {
|
||||
$orderQuery->where('status', StoreActivityOrder::STATUS_VALID);
|
||||
}
|
||||
$orders = $orderQuery->select()->toArray();
|
||||
$orders = reset_index($orders, 'user_id');
|
||||
foreach ($userInfo as &$user) {
|
||||
$user['target_amount'] = $scope['start'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user