From bbf53a6a1f607c89c6aa7515debc43c8d15b3917 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 22 May 2023 09:54:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9redis=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/product/ProductRepository.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 8824dc7a..7f52b967 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -1563,9 +1563,19 @@ class ProductRepository extends BaseRepository Db::rollback(); throw new ValidateException('商品更新出错'); } - if (app()->make(SpuRepository::class)->changeStatus($id, $product->product_type) === false) { + $changeStatus= app()->make(SpuRepository::class)->changeStatus($id, $product->product_type); + if ($changeStatus=== false) { Db::rollback(); throw new ValidateException('商品spu更新出错'); + }else{ + if ($product->product_type==0){ + $RedisCacheService = app()->make(RedisCacheService::class); + if ($status==1){ + $RedisCacheService->SADD ('CloudMerchanSpu'.$product['mer_id'], $product['product_id']); + }else{ + $RedisCacheService->SREM ('CloudMerchanSpu'.$product['mer_id'], $product['product_id']); + } + } } Db::commit(); }