From ea3a3dadc4513b7a1f9a56abd4fc9b68ffd2c6cd Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Fri, 15 Dec 2023 15:58:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/order/StoreCartDao.php | 6 +++--- app/controller/api/store/order/StoreCart.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common/dao/store/order/StoreCartDao.php b/app/common/dao/store/order/StoreCartDao.php index 0f954361..f4760d0f 100644 --- a/app/common/dao/store/order/StoreCartDao.php +++ b/app/common/dao/store/order/StoreCartDao.php @@ -147,10 +147,10 @@ class StoreCartDao extends BaseDao * @return mixed * @author Qinii */ - public function getCartCount(int $uid,$product_type) + public function getCartCount(int $uid,$product_type,$source=0) { - $data = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0])->field('count(*) as count')->select(); - $data[0]['count'] = $data[0]['count'] ? $data[0]['count'] : 0; + $count = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0,'source'=>$source])->count(); + $data[0]['count'] = $count; return $data; } diff --git a/app/controller/api/store/order/StoreCart.php b/app/controller/api/store/order/StoreCart.php index d7cddc64..4692afa0 100644 --- a/app/controller/api/store/order/StoreCart.php +++ b/app/controller/api/store/order/StoreCart.php @@ -190,9 +190,9 @@ class StoreCart extends BaseController * @return mixed * @author Qinii */ - public function cartCount($product_type=0) + public function cartCount($product_type=0,$source=0) { - return app('json')->success($this->repository->getCartCount($this->request->uid(),$product_type)); + return app('json')->success($this->repository->getCartCount($this->request->uid(),$product_type,$source)); } /**