From 0f0883c1a5d0f602fc06bd1aaa754f93bac690cf Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Tue, 23 May 2023 17:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=91=E4=BB=93=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=9F=A5=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 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index 3ce2c637..19ec533b 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -19,6 +19,7 @@ use crmeb\jobs\SyncProductTopJob; use crmeb\services\CopyCommand; use crmeb\services\RedisCacheService; use think\exception\ValidateException; +use think\facade\Db; use think\facade\Log; use app\common\repositories\BaseRepository; use app\common\dao\store\product\SpuDao; @@ -162,11 +163,14 @@ class SpuRepository extends BaseRepository $where['spu_status'] = 1; $where['mer_status'] = 1; $RedisCacheService = app()->make(RedisCacheService::class); - $exists=$RedisCacheService->exists('CloudMerchanSpu'.$where['mer_id']); + $exists=$RedisCacheService->exists('CloudMerchantSpu'.$where['mer_id']); if ($exists){ - $Spu_arr=$RedisCacheService->SRANDMEMBER('CloudMerchanSpu'.$where['mer_id'], 10); + $Spu_arr=$RedisCacheService->SRANDMEMBER('CloudMerchantSpu'.$where['mer_id'], 10); $where['product_id'] =$Spu_arr; + } else { + $where['product_id'] = Db::name('cloud_product')->where('mer_id', $where['mer_id'])->where('status', 1)->orderRand()->limit(10)->column('product_id'); } + unset($where['mer_id']); $query = $this->dao->search($where); $count = 0;