作者 lyh

gx

@@ -59,7 +59,7 @@ class UpdateRoute extends Command @@ -59,7 +59,7 @@ class UpdateRoute extends Command
59 foreach ($list as $v){ 59 foreach ($list as $v){
60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
61 ProjectServer::useProject($v['id']); 61 ProjectServer::useProject($v['id']);
62 - $this->routeMapDeduplication(); 62 + $this->setProductKeyword();
63 DB::disconnect('custom_mysql'); 63 DB::disconnect('custom_mysql');
64 } 64 }
65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -392,8 +392,6 @@ class UpdateRoute extends Command @@ -392,8 +392,6 @@ class UpdateRoute extends Command
392 if($info !== false){ 392 if($info !== false){
393 //删除其他一样的数据 393 //删除其他一样的数据
394 $routeMapModel->del(['id'=>['!=',$info['id']],'source'=>'product_keyword','source_id'=>$info['source_id']]); 394 $routeMapModel->del(['id'=>['!=',$info['id']],'source'=>'product_keyword','source_id'=>$info['source_id']]);
395 - }{  
396 - echo date('Y-m-d H:i:s') . '保留的id:'.$v['id'] . PHP_EOL;  
397 } 395 }
398 } 396 }
399 return true; 397 return true;
@@ -165,9 +165,14 @@ class KeywordLogic extends BaseLogic @@ -165,9 +165,14 @@ 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 + $replace_id = ','.$id.',';
168 $productModel->where('keyword_id', 'like', '%,' . $id . ',%') 169 $productModel->where('keyword_id', 'like', '%,' . $id . ',%')
169 ->update([ 170 ->update([
170 - 'email' => DB::raw("REPLACE(keyword_id, ',' . $id . ',', ',')") 171 + 'email' => DB::raw("REPLACE(keyword_id, '$replace_id' , ',')")
  172 + ]);
  173 + $productModel->where('keyword_id', ',')
  174 + ->update([
  175 + 'email' => DB::raw("REPLACE(keyword_id, ',' , '')")
171 ]); 176 ]);
172 $this->delRoute($id); 177 $this->delRoute($id);
173 $this->model->del(['id'=>$id]); 178 $this->model->del(['id'=>$id]);