正在显示
1 个修改的文件
包含
8 行增加
和
15 行删除
| @@ -103,22 +103,15 @@ class KeywordLogic extends BaseLogic | @@ -103,22 +103,15 @@ class KeywordLogic extends BaseLogic | ||
| 103 | */ | 103 | */ |
| 104 | public function keywordDelete(){ | 104 | public function keywordDelete(){ |
| 105 | $ids = $this->param['ids']; | 105 | $ids = $this->param['ids']; |
| 106 | -// DB::beginTransaction(); | ||
| 107 | -// try { | ||
| 108 | - $productModel = new Product(); | ||
| 109 | - foreach ($ids as $id){ | ||
| 110 | - $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]); | ||
| 111 | - if($product_info !== false){ | ||
| 112 | - $this->fail('当前关键词拥有产品不允许删除'); | ||
| 113 | - } | ||
| 114 | - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | 106 | + $productModel = new Product(); |
| 107 | + foreach ($ids as $id){ | ||
| 108 | + $product_info = $productModel->read(['keyword_id'=>['like','%,'.$id.',%']]); | ||
| 109 | + if($product_info !== false){ | ||
| 110 | + $this->fail('当前关键词拥有产品不允许删除'); | ||
| 115 | } | 111 | } |
| 116 | - $this->model->del(['id'=>['in',$ids]]); | ||
| 117 | -// DB::commit(); | ||
| 118 | -// }catch (\Exception $e){ | ||
| 119 | -// DB::rollBack(); | ||
| 120 | -// $this->fail('删除失败'); | ||
| 121 | -// } | 112 | + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); |
| 113 | + } | ||
| 114 | + $this->model->del(['id'=>['in',$ids]]); | ||
| 122 | return $this->success(); | 115 | return $this->success(); |
| 123 | } | 116 | } |
| 124 | 117 |
-
请 注册 或 登录 后发表评论