正在显示
1 个修改的文件
包含
17 行增加
和
21 行删除
| @@ -140,32 +140,28 @@ class KeywordLogic extends BaseLogic | @@ -140,32 +140,28 @@ class KeywordLogic extends BaseLogic | ||
| 140 | if (empty($route_array)) { | 140 | if (empty($route_array)) { |
| 141 | $this->fail('路由生成失败,请稍后重试!'); | 141 | $this->fail('路由生成失败,请稍后重试!'); |
| 142 | } | 142 | } |
| 143 | - try { | ||
| 144 | - $num = count($this->param['title']); | ||
| 145 | - if($num > 1000){ | ||
| 146 | - $this->fail('最大数量不能超过1000'); | 143 | + $num = count($this->param['title']); |
| 144 | + if($num > 1000){ | ||
| 145 | + $this->fail('最大数量不能超过1000'); | ||
| 146 | + } | ||
| 147 | + foreach ($this->param['title'] as $k=>$v){ | ||
| 148 | + if(empty($v)){ | ||
| 149 | + continue; | ||
| 147 | } | 150 | } |
| 148 | - foreach ($this->param['title'] as $k=>$v){ | ||
| 149 | - if(empty($v)){ | ||
| 150 | - continue; | ||
| 151 | - } | ||
| 152 | - $this->model = new Keyword(); | ||
| 153 | - $info = $this->model->read(['title'=>$v]); | ||
| 154 | - if($info === false){ | 151 | + $this->model = new Keyword(); |
| 152 | + $info = $this->model->read(['title'=>$v]); | ||
| 153 | + if($info === false){ | ||
| 155 | // $route = $this->specialRouteCheck($v); | 154 | // $route = $this->specialRouteCheck($v); |
| 156 | - $param['project_id'] = $this->user['project_id']; | ||
| 157 | - $param['created_at'] = date('Y-m-d H:i:s'); | ||
| 158 | - $param['updated_at'] = $param['created_at']; | ||
| 159 | - $param['title'] = $v; | 155 | + $param['project_id'] = $this->user['project_id']; |
| 156 | + $param['created_at'] = date('Y-m-d H:i:s'); | ||
| 157 | + $param['updated_at'] = $param['created_at']; | ||
| 158 | + $param['title'] = $v; | ||
| 160 | // $param['route'] = $route; | 159 | // $param['route'] = $route; |
| 161 | - $id = $this->model->insertGetId($param); | ||
| 162 | - $route = RouteMap::setRoute($route_array[$k], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | 160 | + $id = $this->model->insertGetId($param); |
| 161 | + $route = RouteMap::setRoute($route_array[$k], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 163 | // $this->curlDelRoute(['new_route'=>$route]); | 162 | // $this->curlDelRoute(['new_route'=>$route]); |
| 164 | - $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 165 | - } | 163 | + $this->model->edit(['route'=>$route],['id'=>$id]); |
| 166 | } | 164 | } |
| 167 | - }catch (\Exception $e){ | ||
| 168 | - $this->fail('error'); | ||
| 169 | } | 165 | } |
| 170 | return $this->success(); | 166 | return $this->success(); |
| 171 | } | 167 | } |
-
请 注册 或 登录 后发表评论