正在显示
1 个修改的文件
包含
15 行增加
和
7 行删除
| @@ -29,8 +29,8 @@ class ProductLogic extends BaseLogic | @@ -29,8 +29,8 @@ class ProductLogic extends BaseLogic | ||
| 29 | 29 | ||
| 30 | public function productSave(){ | 30 | public function productSave(){ |
| 31 | $this->param = $this->handleSaveParam($this->param); | 31 | $this->param = $this->handleSaveParam($this->param); |
| 32 | -// DB::beginTransaction(); | ||
| 33 | -// try { | 32 | + DB::beginTransaction(); |
| 33 | + try { | ||
| 34 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 34 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 35 | $id = $this->param['id']; | 35 | $id = $this->param['id']; |
| 36 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 36 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| @@ -42,11 +42,11 @@ class ProductLogic extends BaseLogic | @@ -42,11 +42,11 @@ class ProductLogic extends BaseLogic | ||
| 42 | } | 42 | } |
| 43 | //路由映射 | 43 | //路由映射 |
| 44 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 44 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 45 | -// DB::commit(); | ||
| 46 | -// }catch (\Exception $e){ | ||
| 47 | -// DB::rollBack(); | ||
| 48 | -// $this->fail('保存失败'); | ||
| 49 | -// } | 45 | + DB::commit(); |
| 46 | + }catch (\Exception $e){ | ||
| 47 | + DB::rollBack(); | ||
| 48 | + $this->fail('保存失败'); | ||
| 49 | + } | ||
| 50 | //通知更新 | 50 | //通知更新 |
| 51 | $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]); | 51 | $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]); |
| 52 | return $this->success(); | 52 | return $this->success(); |
| @@ -74,6 +74,14 @@ class ProductLogic extends BaseLogic | @@ -74,6 +74,14 @@ class ProductLogic extends BaseLogic | ||
| 74 | $param['created_uid'] = $this->user['id']; | 74 | $param['created_uid'] = $this->user['id']; |
| 75 | return $param; | 75 | return $param; |
| 76 | } | 76 | } |
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * @remark :删除数据 | ||
| 80 | + * @name :delete | ||
| 81 | + * @author :lyh | ||
| 82 | + * @method :post | ||
| 83 | + * @time :2023/8/21 17:11 | ||
| 84 | + */ | ||
| 77 | public function delete($ids, $map =[]){ | 85 | public function delete($ids, $map =[]){ |
| 78 | $ids= array_filter(Arr::splitFilterToArray($ids), 'intval'); | 86 | $ids= array_filter(Arr::splitFilterToArray($ids), 'intval'); |
| 79 | DB::beginTransaction(); | 87 | DB::beginTransaction(); |
-
请 注册 或 登录 后发表评论