This commit is contained in:
mkm 2023-11-21 09:37:09 +08:00
parent b1d1d54187
commit 5867fe5895

View File

@ -284,8 +284,9 @@ class ProductRepository extends BaseRepository
$spuData['price'] = $settleParams['data']['price'];
$spuData['mer_id'] = $merId;
$spuData['mer_labels'] = $data['mer_labels'];
Db::transaction(function () use ($id, $data, $productType, $settleParams, $content, $product, $spuData, $merId) {
$this->save($id, $settleParams, $content, $product, $productType);
Db::startTrans();
try{
$res=$this->save($id, $settleParams, $content, $product, $productType);
// if ($productType == 1) { //秒杀商品
// $dat = $this->setSeckillProduct($data);
// app()->make(StoreSeckillActiveRepository::class)->updateByProduct($id, $dat);
@ -301,7 +302,12 @@ class ProductRepository extends BaseRepository
event('product.sell', ['product_id' => [$id]]);
}
app()->make(SpuRepository::class)->changeStatus($id, $productType);
});
Db::commit();
return $res;
}catch(\Exception $e){
Db::rollback();
return false;
}
}
public function freeTrial(int $id, array $data, int $merId)