正在显示
1 个修改的文件
包含
8 行增加
和
7 行删除
| @@ -53,13 +53,14 @@ class ProductLogic extends BaseLogic | @@ -53,13 +53,14 @@ class ProductLogic extends BaseLogic | ||
| 53 | }else{ | 53 | }else{ |
| 54 | $this->param['category_id'] = ''; | 54 | $this->param['category_id'] = ''; |
| 55 | } | 55 | } |
| 56 | -// DB::connection('custom_mysql')->beginTransaction(); | ||
| 57 | -// try { | 56 | + DB::connection('custom_mysql')->beginTransaction(); |
| 57 | + try { | ||
| 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 59 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 59 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 60 | //查看路由是否更新 | 60 | //查看路由是否更新 |
| 61 | $this->editProductRoute($this->param['id'],$this->param['route']); | 61 | $this->editProductRoute($this->param['id'],$this->param['route']); |
| 62 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 62 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 63 | + $id = $this->param['id']; | ||
| 63 | }else{ | 64 | }else{ |
| 64 | $this->param = $this->addHandleParam($this->param); | 65 | $this->param = $this->addHandleParam($this->param); |
| 65 | $id = $this->model->addReturnId($this->param); | 66 | $id = $this->model->addReturnId($this->param); |
| @@ -71,11 +72,11 @@ class ProductLogic extends BaseLogic | @@ -71,11 +72,11 @@ class ProductLogic extends BaseLogic | ||
| 71 | CategoryRelated::saveRelated($id, $category_ids); | 72 | CategoryRelated::saveRelated($id, $category_ids); |
| 72 | //保存扩展字段 | 73 | //保存扩展字段 |
| 73 | $this->saveExtendInfo($id,$extend); | 74 | $this->saveExtendInfo($id,$extend); |
| 74 | -// DB::connection('custom_mysql')->commit(); | ||
| 75 | -// }catch (\Exception $e){ | ||
| 76 | -// DB::connection('custom_mysql')->rollBack(); | ||
| 77 | -// $this->fail('系统错误请联系管理员'); | ||
| 78 | -// } | 75 | + DB::connection('custom_mysql')->commit(); |
| 76 | + }catch (\Exception $e){ | ||
| 77 | + DB::connection('custom_mysql')->rollBack(); | ||
| 78 | + $this->fail('系统错误请联系管理员'); | ||
| 79 | + } | ||
| 79 | return $this->success(); | 80 | return $this->success(); |
| 80 | } | 81 | } |
| 81 | 82 |
-
请 注册 或 登录 后发表评论