From 03fc06b9d27a90b1d963776b3b85f776ad6f806d Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Tue, 26 Sep 2023 19:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=95=86=E5=93=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/store/product/SpuRepository.php | 8 +++----- app/controller/api/store/product/StoreSpu.php | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index 28169d2d..33cbf4bb 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -164,7 +164,7 @@ class SpuRepository extends BaseRepository return compact('count', 'list'); } - public function getApiCloudSearch($where, $page, $limit, $rand = true) + public function getApiCloudSearch($where, $page, $limit, $rand = false) { $where = array_merge(Product::searchEnable(), $where); if (!empty($where['keyword'])) { @@ -178,7 +178,6 @@ class SpuRepository extends BaseRepository app()->make(UserVisitRepository::class)->searchProduct($this->userInfo ? $this->userInfo['uid'] : 0, $where['keyword'], (int)($where['mer_id'] ?? 0)); } } - if ($rand) { $dataKey = sprintf(CloudProduct::CacheKey, $where['mer_id']); $RedisCacheService = app()->make(RedisCacheService::class); @@ -193,12 +192,11 @@ class SpuRepository extends BaseRepository unset($where['mer_id'], $where['page']); $page = 1; } - + $entryMerId = $where['entry_mer_id'] ?? ''; unset($where['entry_mer_id']); $query = $this->dao->search($where); - - $count = $query->count(); + $count = $query->fetchSql(false)->count(); $query->with([ 'merchant' => function ($query) { $query->field($this->merchantFiled)->with(['type_name']); diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 46013551..555cd165 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -143,13 +143,13 @@ class StoreSpu extends BaseController ]); if ($where['action']) unset($where['product_type']); $currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find(); - $typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id'); + $typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id'); $mer_id = Db::name('merchant') ->where('street_id',$currentMerchant['street_id']) ->where('mer_state',1) ->where('status',1) ->where('category_id',$currentMerchant['category_id']) - ->where('type_id', $typeCloudWarehouseId) + ->where('type_id', $typeTownSupplyChainId) ->value('mer_id'); if (!$mer_id) { return app('json')->success(['count'=>0,'list'=>[]]);