正在显示
1 个修改的文件
包含
9 行增加
和
9 行删除
| @@ -90,11 +90,11 @@ class ProductLogic extends BaseLogic | @@ -90,11 +90,11 @@ class ProductLogic extends BaseLogic | ||
| 90 | * @time :2023/8/21 17:11 | 90 | * @time :2023/8/21 17:11 |
| 91 | */ | 91 | */ |
| 92 | public function productDelete(){ | 92 | public function productDelete(){ |
| 93 | -// DB::beginTransaction(); | ||
| 94 | -// try { | 93 | + DB::beginTransaction(); |
| 94 | + try { | ||
| 95 | foreach ($this->param['ids'] as $k => $id) { | 95 | foreach ($this->param['ids'] as $k => $id) { |
| 96 | $info = $this->model->read(['id'=>$id]); | 96 | $info = $this->model->read(['id'=>$id]); |
| 97 | - if($info->status == Product::STATUS_RECYCLE){ | 97 | + if($info['status'] == Product::STATUS_RECYCLE){ |
| 98 | //删除路由映射 | 98 | //删除路由映射 |
| 99 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 99 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 100 | //删除当前产品模版 | 100 | //删除当前产品模版 |
| @@ -102,14 +102,14 @@ class ProductLogic extends BaseLogic | @@ -102,14 +102,14 @@ class ProductLogic extends BaseLogic | ||
| 102 | $this->model->del(['id'=>$id]); | 102 | $this->model->del(['id'=>$id]); |
| 103 | }else{ | 103 | }else{ |
| 104 | //回收站 | 104 | //回收站 |
| 105 | - $this->model->edit(['status'=>2],['id'=>$id]); | 105 | + $this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]); |
| 106 | + } | ||
| 106 | } | 107 | } |
| 108 | + DB::commit(); | ||
| 109 | + }catch (\Exception $e){ | ||
| 110 | + DB::rollBack(); | ||
| 111 | + $this->fail('删除失败'); | ||
| 107 | } | 112 | } |
| 108 | -// DB::commit(); | ||
| 109 | -// }catch (\Exception $e){ | ||
| 110 | -// DB::rollBack(); | ||
| 111 | -// $this->fail('删除失败'); | ||
| 112 | -// } | ||
| 113 | 113 | ||
| 114 | return $this->success(); | 114 | return $this->success(); |
| 115 | } | 115 | } |
-
请 注册 或 登录 后发表评论