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(); }