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