作者 lyh

gx

... ... @@ -53,13 +53,14 @@ class ProductLogic extends BaseLogic
}else{
$this->param['category_id'] = '';
}
// DB::connection('custom_mysql')->beginTransaction();
// try {
DB::connection('custom_mysql')->beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
//查看路由是否更新
$this->editProductRoute($this->param['id'],$this->param['route']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
$id = $this->param['id'];
}else{
$this->param = $this->addHandleParam($this->param);
$id = $this->model->addReturnId($this->param);
... ... @@ -71,11 +72,11 @@ class ProductLogic extends BaseLogic
CategoryRelated::saveRelated($id, $category_ids);
//保存扩展字段
$this->saveExtendInfo($id,$extend);
// DB::connection('custom_mysql')->commit();
// }catch (\Exception $e){
// DB::connection('custom_mysql')->rollBack();
// $this->fail('系统错误请联系管理员');
// }
DB::connection('custom_mysql')->commit();
}catch (\Exception $e){
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误请联系管理员');
}
return $this->success();
}
... ...