作者 lyh

gx

@@ -165,10 +165,10 @@ class KeywordLogic extends BaseLogic @@ -165,10 +165,10 @@ class KeywordLogic extends BaseLogic
165 $ids = $this->param['ids']; 165 $ids = $this->param['ids'];
166 $productModel = new Product(); 166 $productModel = new Product();
167 foreach ($ids as $id){ 167 foreach ($ids as $id){
168 - $product_info = $productModel->read(['keyword_id'=>['like','%,'.$id.',%']]);  
169 - if($product_info !== false){  
170 - $this->fail('当前关键词拥有产品不允许删除');  
171 - } 168 + $productModel->where('keyword_id', 'like', '%,' . $id . ',%')
  169 + ->update([
  170 + 'email' => DB::raw("REPLACE(keyword_id, '%,' . $id . ',%', ',')")
  171 + ]);
172 $this->delRoute($id); 172 $this->delRoute($id);
173 $this->model->del(['id'=>$id]); 173 $this->model->del(['id'=>$id]);
174 } 174 }