作者 lyh

gx

... ... @@ -334,23 +334,20 @@ class ProductLogic extends BaseLogic
* @time :2023/8/15 17:53
*/
public function batchSetCategory(){
// DB::beginTransaction();
// try {
//删除分类关联表记录
$categoryRelatedModel = new CategoryRelated();
$categoryRelatedModel->del(['product_id'=>['in',$this->param['id']]]);
DB::beginTransaction();
try {
//批量
$param = [
'category_id'=>','.Arr::arrToSet($this->param['category_id']).',',
'status'=>$this->param['status']
];
$this->model->edit($param,['id'=>['in',$this->param['id']]]);
// DB::commit();
// //对应添加关联表
// }catch (\Exception $e){
// DB::rollBack();
DB::commit();
//对应添加关联表
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
// }
}
return $this->success();
}
... ...