作者 lyh

gx

... ... @@ -283,8 +283,8 @@ class ProductLogic extends BaseLogic
* @time :2023/8/15 17:53
*/
public function batchSetCategory(){
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
//删除分类关联表记录
$categoryRelatedModel = new CategoryRelated();
$categoryRelatedModel->del(['product_id'=>['in',$this->param['id']]]);
... ... @@ -300,12 +300,12 @@ class ProductLogic extends BaseLogic
CategoryRelated::saveRelated($v1,$v2);
}
}
// DB::commit();
// //对应添加关联表
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('error');
// }
DB::commit();
//对应添加关联表
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
return $this->success();
}
}
... ...