From c51850a61dfc4330b2b26cf5ab4f9e92a5eb564b Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Sat, 8 Jul 2023 10:18:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=85=E4=BB=98=E6=AC=BE?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/order/StoreGroupOrderDao.php | 13 ++++++++----- .../store/order/StoreGroupOrderRepository.php | 2 +- app/controller/api/store/order/StoreOrder.php | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/common/dao/store/order/StoreGroupOrderDao.php b/app/common/dao/store/order/StoreGroupOrderDao.php index 5826df98..a9ecd3aa 100644 --- a/app/common/dao/store/order/StoreGroupOrderDao.php +++ b/app/common/dao/store/order/StoreGroupOrderDao.php @@ -16,6 +16,7 @@ namespace app\common\dao\store\order; use app\common\dao\BaseDao; use app\common\model\store\order\StoreGroupOrder; +use app\common\model\store\order\StoreOrder; /** * Class StoreGroupOrderDao @@ -57,14 +58,16 @@ class StoreGroupOrderDao extends BaseDao */ public function search(array $where) { - return StoreGroupOrder::getDB()->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) { - $query->where('paid', $where['paid']); + $storeOrderWhere = StoreOrder::where('activity_type', $where['product_type']); + return StoreGroupOrder::hasWhere('orderList', $storeOrderWhere) + ->when(isset($where['paid']) && $where['paid'] !== '', function ($query) use ($where) { + $query->where('StoreGroupOrder.paid', $where['paid']); })->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) { - $query->where('uid', $where['uid']); + $query->where('StoreGroupOrder.uid', $where['uid']); })->order('create_time DESC')->when(isset($where['is_del']) && $where['is_del'] !== '', function ($query) use ($where) { - $query->where('is_del', $where['is_del']); + $query->where('StoreGroupOrder.is_del', $where['is_del']); }, function ($query) { - $query->where('is_del', 0); + $query->where('StoreGroupOrder.is_del', 0); }); } diff --git a/app/common/repositories/store/order/StoreGroupOrderRepository.php b/app/common/repositories/store/order/StoreGroupOrderRepository.php index 42a521d5..f19272a3 100644 --- a/app/common/repositories/store/order/StoreGroupOrderRepository.php +++ b/app/common/repositories/store/order/StoreGroupOrderRepository.php @@ -63,7 +63,7 @@ class StoreGroupOrderRepository extends BaseRepository $query = $this->search($where); $count = $query->count(); $list = $query->with(['orderList' => function (Relation $query) { - $query->field('order_id,group_order_id,activity_type,pay_price')->with(['orderProduct','presellOrder']); + $query->field('order_id,group_order_id,activity_type,pay_price,status')->with(['orderProduct','presellOrder']); }])->page($page, $limit)->order('create_time DESC')->select(); return compact('count', 'list'); } diff --git a/app/controller/api/store/order/StoreOrder.php b/app/controller/api/store/order/StoreOrder.php index dda06356..4792f557 100644 --- a/app/controller/api/store/order/StoreOrder.php +++ b/app/controller/api/store/order/StoreOrder.php @@ -179,7 +179,8 @@ class StoreOrder extends BaseController public function groupOrderList(StoreGroupOrderRepository $groupOrderRepository) { [$page, $limit] = $this->getPage(); - $list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0], $page, $limit); + $productType = $this->request->param('product_type', 0); + $list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0, 'product_type' => $productType], $page, $limit); return app('json')->success($list); }