正在显示
1 个修改的文件
包含
3 行增加
和
9 行删除
| @@ -126,7 +126,6 @@ class KeywordLogic extends BaseLogic | @@ -126,7 +126,6 @@ class KeywordLogic extends BaseLogic | ||
| 126 | */ | 126 | */ |
| 127 | public function batchAdd(){ | 127 | public function batchAdd(){ |
| 128 | try { | 128 | try { |
| 129 | - $idArr = []; | ||
| 130 | foreach ($this->param['title'] as $v){ | 129 | foreach ($this->param['title'] as $v){ |
| 131 | $this->model = new Keyword(); | 130 | $this->model = new Keyword(); |
| 132 | $info = $this->model->read(['title'=>$v]); | 131 | $info = $this->model->read(['title'=>$v]); |
| @@ -136,16 +135,11 @@ class KeywordLogic extends BaseLogic | @@ -136,16 +135,11 @@ class KeywordLogic extends BaseLogic | ||
| 136 | $param['updated_at'] = $param['created_at']; | 135 | $param['updated_at'] = $param['created_at']; |
| 137 | $param['title'] = $v; | 136 | $param['title'] = $v; |
| 138 | $id = $this->model->insertGetId($param); | 137 | $id = $this->model->insertGetId($param); |
| 139 | - $idArr[] = ['id'=>$id,'title'=>$v]; | 138 | + $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); |
| 139 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 140 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 140 | } | 141 | } |
| 141 | } | 142 | } |
| 142 | - //批量生成路由 | ||
| 143 | - foreach ($idArr as $v){ | ||
| 144 | - $this->model = new Keyword(); | ||
| 145 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); | ||
| 146 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 147 | - $this->model->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 148 | - } | ||
| 149 | }catch (\Exception $e){ | 143 | }catch (\Exception $e){ |
| 150 | $this->fail('error'); | 144 | $this->fail('error'); |
| 151 | } | 145 | } |
-
请 注册 或 登录 后发表评论