diff --git a/app/common/dao/store/product/SpuDao.php b/app/common/dao/store/product/SpuDao.php index 1ce6bac7..e47d20b6 100755 --- a/app/common/dao/store/product/SpuDao.php +++ b/app/common/dao/store/product/SpuDao.php @@ -55,6 +55,11 @@ class SpuDao extends BaseDao if(isset($where['order']) && $where['order'] === 'none'){ $order = ''; } + + if(isset($where['order_remark']) && $where['order_remark'] === 'none'){ + $order = ''; + } + $query = Spu::getDB()->alias('S')->join('StoreProduct P','S.product_id = P.product_id', 'left'); $query->when(isset($where['is_del']) && $where['is_del'] !== '',function($query)use($where){ $query->where('P.is_del',$where['is_del']); @@ -90,9 +95,9 @@ class SpuDao extends BaseDao ->when(isset($where['is_trader']) && $where['is_trader'] !== '',function($query)use($where){ $merId = app()->make(MerchantRepository::class)->search([ 'is_trader' => $where['is_trader'], - 'status' => 1, - 'mer_state' => 1, - 'is_del' => 1, + 'status' => 1,//状态正常 + 'mer_state' => 1,//商户开启 + 'is_del' => 1,// ])->column('mer_id'); $query->whereIn('P.mer_id',$merId); diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index e9f8860c..5c9368e3 100755 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -154,6 +154,19 @@ class SpuRepository extends BaseRepository if (!empty($this->orderField)) { $this->dao->orderField = $this->orderField; } + //取消数量排序 + $where['order_remark'] = "none"; + $queryCount = $this->dao->search($where); +// $queryCount->with([ +// 'merchant' => function ($queryCount) { +// $queryCount->field($this->merchantFiled)->with(['type_names', 'street_names']); +// }, +// 'issetCoupon', +// 'product.attrValue', +// ]); + unset($where['order_remark']); + $count = $queryCount->count(); + $query = $this->dao->search($where); $query->with([ @@ -164,7 +177,7 @@ class SpuRepository extends BaseRepository 'product.attrValue', ]); $productMake = app()->make(ProductRepository::class); - $count = $query->count(); +// $count = $query->count(); if ($limit == 0) { $list = $query->setOption('field', [])->field($this->productFiled)->select() ->each(function ($item) use ($is_sku, $productMake, $userInfo,$where) {