diff --git a/app/common/repositories/store/order/StoreGroupOrderRepository.php b/app/common/repositories/store/order/StoreGroupOrderRepository.php index 46ee5bfa..c84e7547 100644 --- a/app/common/repositories/store/order/StoreGroupOrderRepository.php +++ b/app/common/repositories/store/order/StoreGroupOrderRepository.php @@ -63,11 +63,24 @@ class StoreGroupOrderRepository extends BaseRepository */ public function getList(array $where, $page, $limit) { - $query = $this->search($where); + $query = StoreGroupOrder::getDB()->alias('StoreGroupOrder'); if (isset($where['product_type'])) { $storeOrderWhere = StoreOrder::where('activity_type', $where['product_type']); $query->hasWhere('orderList', $storeOrderWhere); } + $query->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) { + if ($where['paid'] == 0) { + $query->whereRaw("StoreGroupOrder.paid=0 or (StoreGroupOrder.paid=1 and StoreGroupOrder.pay_type=8)"); + } else { + $query->where('StoreGroupOrder.paid', $where['paid']); + } + })->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) { + $query->where('StoreGroupOrder.uid', $where['uid']); + })->order('create_time DESC')->when(isset($where['is_del']) && $where['is_del'] !== '', function ($query) use ($where) { + $query->where('StoreGroupOrder.is_del', $where['is_del']); + }, function ($query) { + $query->where('StoreGroupOrder.is_del', 0); + }); $count = $query->count(); $list = $query->with(['orderList' => function (Relation $query) { $query->field('order_id,group_order_id,activity_type,pay_price,status,mer_id')->with(['merchant' => function ($query) {