From c242e5d721744c15725e40ed5daefbf92acbba39 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 22 May 2023 11:41:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=B8=8A=E6=9E=B6redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/product/ProductRepository.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 7f52b967..dda43ccb 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -1597,6 +1597,18 @@ class ProductRepository extends BaseRepository throw new ValidateException('ID:'.$product->product_id . ' 商品正在参与助力活动'); } $this->dao->updates($id,[$field => $status]); + if ($product->product_type==0){ + $RedisCacheService = app()->make(RedisCacheService::class); + if ($status==1){ + foreach ($id as $k=>$v){ + $RedisCacheService->SADD ('CloudMerchanSpu'.$product['mer_id'], $v); + } + }else{ + foreach ($id as $k=>$v){ + $RedisCacheService->SREM ('CloudMerchanSpu'.$product['mer_id'], $v); + } + } + } Queue::push(ChangeSpuStatusJob::class,['id' => $id,'product_type'=> $product_type]); }