作者 lyh

gx

@@ -52,18 +52,18 @@ class KeywordLogic extends BaseLogic @@ -52,18 +52,18 @@ class KeywordLogic extends BaseLogic
52 DB::beginTransaction(); 52 DB::beginTransaction();
53 try { 53 try {
54 if(isset($this->param['id']) && !empty($this->param['id'])){ 54 if(isset($this->param['id']) && !empty($this->param['id'])){
55 - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $this->param['id'], $this->user['project_id']);  
56 - $id = $this->editCategoryRoute($this->param['id'],$route);  
57 - $this->model->edit($this->param,['id'=>$id]); 55 + $info = $this->model->read(['id'=>$this->param['id']],['id','route']);
  56 + $route = $info['route'];
  57 + $this->model->edit($this->param,['id'=>$info['id']]);
58 }else{ 58 }else{
59 $this->param['project_id'] = $this->user['project_id']; 59 $this->param['project_id'] = $this->user['project_id'];
60 $this->param['created_at'] = date('Y-m-d H:i:s'); 60 $this->param['created_at'] = date('Y-m-d H:i:s');
61 $this->param['updated_at'] = $this->param['created_at']; 61 $this->param['updated_at'] = $this->param['created_at'];
62 $id = $this->model->insertGetId($this->param); 62 $id = $this->model->insertGetId($this->param);
  63 + //路由映射
  64 + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  65 + $this->model->edit(['route'=>$route],['id'=>$id]);
63 } 66 }
64 - //路由映射  
65 - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);  
66 - $this->model->edit(['route'=>$route],['id'=>$id]);  
67 //清除缓存 67 //清除缓存
68 Common::del_user_cache('product_keyword',$this->user['project_id']); 68 Common::del_user_cache('product_keyword',$this->user['project_id']);
69 DB::commit(); 69 DB::commit();
@@ -77,26 +77,6 @@ class KeywordLogic extends BaseLogic @@ -77,26 +77,6 @@ class KeywordLogic extends BaseLogic
77 } 77 }
78 78
79 /** 79 /**
80 - * @remark :编辑路由时生成路由记录  
81 - * @name :editCategoryRoute  
82 - * @author :lyh  
83 - * @method :post  
84 - * @time :2023/9/7 10:51  
85 - */  
86 - public function editCategoryRoute($id,$route){  
87 - //生成一条删除路由记录  
88 - $info = $this->model->read(['id'=>$id],['id','route']);  
89 - if($info['route'] != $route){  
90 - $data = [  
91 - 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,  
92 - 'route'=>$info['route'],  
93 - ];  
94 - $this->setRouteDeleteSave($data);  
95 - }  
96 - return $id;  
97 - }  
98 -  
99 - /**  
100 * @remark :批量添加数据 80 * @remark :批量添加数据
101 * @name :batchAdd 81 * @name :batchAdd
102 * @author :lyh 82 * @author :lyh