正在显示
1 个修改的文件
包含
11 行增加
和
8 行删除
| @@ -107,14 +107,17 @@ class KeywordLogic extends BaseLogic | @@ -107,14 +107,17 @@ class KeywordLogic extends BaseLogic | ||
| 107 | public function batchAdd(){ | 107 | public function batchAdd(){ |
| 108 | if(!empty($this->param['title']) && is_array($this->param['title'])){ | 108 | if(!empty($this->param['title']) && is_array($this->param['title'])){ |
| 109 | foreach ($this->param['title'] as $v){ | 109 | foreach ($this->param['title'] as $v){ |
| 110 | - $param['project_id'] = $this->user['project_id']; | ||
| 111 | - $param['created_at'] = date('Y-m-d H:i:s'); | ||
| 112 | - $param['updated_at'] = $param['created_at']; | ||
| 113 | - $param['title'] = $v; | ||
| 114 | - $id = $this->model->insertGetId($param); | ||
| 115 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($id.'---'.$v, true) . PHP_EOL, FILE_APPEND); | ||
| 116 | - $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 117 | - $this->model->edit(['route'=>$route],['id'=>$id]); | 110 | + $info = $this->model->read(['title'=>$v]); |
| 111 | + if($info === false){ | ||
| 112 | + $param['project_id'] = $this->user['project_id']; | ||
| 113 | + $param['created_at'] = date('Y-m-d H:i:s'); | ||
| 114 | + $param['updated_at'] = $param['created_at']; | ||
| 115 | + $param['title'] = $v; | ||
| 116 | + $id = $this->model->insertGetId($param); | ||
| 117 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($id.'---'.$v, true) . PHP_EOL, FILE_APPEND); | ||
| 118 | + $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 119 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 120 | + } | ||
| 118 | } | 121 | } |
| 119 | } | 122 | } |
| 120 | return $this->success(); | 123 | return $this->success(); |
-
请 注册 或 登录 后发表评论