From 5198b9542863298d3eeb35c53f02dbc2773f2eb9 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Fri, 15 Mar 2024 11:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/order/StoreCartDao.php | 5 +++-- app/common/dao/store/product/SpuDao.php | 2 +- .../repositories/store/order/StoreCartRepository.php | 7 ++++--- app/controller/api/store/order/StoreCart.php | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/common/dao/store/order/StoreCartDao.php b/app/common/dao/store/order/StoreCartDao.php index 26944a5f..14876644 100644 --- a/app/common/dao/store/order/StoreCartDao.php +++ b/app/common/dao/store/order/StoreCartDao.php @@ -50,11 +50,12 @@ class StoreCartDao extends BaseDao * @Author:Qinii * @Date: 2020/6/1 * @param int $uid + * @param int $saleType * @return mixed */ - public function getAll(int $uid) + public function getAll(int $uid, int $saleType = 1) { - $query = ($this->getModel())::where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0]) + $query = ($this->getModel())::where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0, 'sale_type' => $saleType]) ->with([ 'product' => function ($query) { $query->field('product_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,is_used,product_type,once_max_count,once_min_count,pay_limit,mer_svip_status,svip_price_type'); diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index 2537a8f6..bbb10706 100644 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -73,7 +73,7 @@ class SpuDao extends BaseDao $query->whereIn('P.mer_id',$where['mer_ids']); }) ->when(isset($where['sale_type']) && $where['sale_type'] !== '',function($query)use($where){ - $saleType = $where['sale_type'] == Enum::SALE_TYPE_RETAIL ? [Enum::RETAIL_ONLY, Enum::RETAIL_WHOLESALE] : [Enum::WHOLESALE_ONLY]; + $saleType = $where['sale_type'] == Enum::SALE_TYPE_RETAIL ? [Enum::RETAIL_ONLY, Enum::RETAIL_WHOLESALE] : [Enum::WHOLESALE_ONLY, Enum::RETAIL_WHOLESALE]; $merIds = Merchant::whereIn('wholesale', $saleType)->column('mer_id'); $query->whereIn('P.mer_id', $merIds); }) diff --git a/app/common/repositories/store/order/StoreCartRepository.php b/app/common/repositories/store/order/StoreCartRepository.php index 7604c7e1..4455f21d 100644 --- a/app/common/repositories/store/order/StoreCartRepository.php +++ b/app/common/repositories/store/order/StoreCartRepository.php @@ -46,13 +46,14 @@ class StoreCartRepository extends BaseRepository } /** - * @param $uid + * @param $user + * @param int $saleType * @return array * @author Qinii */ - public function getList($user) + public function getList($user, int $saleType = 1) { - $res = $this->dao->getAll($user->uid)->append(['checkCartProduct', 'UserPayCount', 'ActiveSku','spu']); + $res = $this->dao->getAll($user->uid, $saleType)->append(['checkCartProduct', 'UserPayCount', 'ActiveSku','spu']); return $this->checkCartList($res, $user->uid, $user); } diff --git a/app/controller/api/store/order/StoreCart.php b/app/controller/api/store/order/StoreCart.php index 799feba3..3ad1f05a 100644 --- a/app/controller/api/store/order/StoreCart.php +++ b/app/controller/api/store/order/StoreCart.php @@ -56,7 +56,8 @@ class StoreCart extends BaseController */ public function lst() { - $data = $this->repository->getList($this->request->userInfo()); + $saleType = $this->request->get('sale_type', 1); + $data = $this->repository->getList($this->request->userInfo(), intval($saleType)); return app('json')->success($data); }