Merge pull request '批量上架redis' (#10) from dev into master

Reviewed-on: http://git.excellentkk.cn/mkm/shop-php/pulls/10
This commit is contained in:
mkm 2023-05-22 11:42:21 +08:00
commit d1743743e0

View File

@ -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]);
}