修改redis数据

This commit is contained in:
mkm 2023-05-22 09:54:06 +08:00
parent 5be0c7ce07
commit bbf53a6a1f

View File

@ -1563,9 +1563,19 @@ class ProductRepository extends BaseRepository
Db::rollback(); Db::rollback();
throw new ValidateException('商品更新出错'); 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(); Db::rollback();
throw new ValidateException('商品spu更新出错'); 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(); Db::commit();
} }