作者 lyh

gx

@@ -136,10 +136,10 @@ class KeywordLogic extends BaseLogic @@ -136,10 +136,10 @@ class KeywordLogic extends BaseLogic
136 * @time :2023/8/28 14:03 136 * @time :2023/8/28 14:03
137 */ 137 */
138 public function batchAdd(){ 138 public function batchAdd(){
139 - $route_array = Translate::tran($this->param['title'], 'en');  
140 - if (empty($route_array)) {  
141 - $this->fail('路由生成失败,请稍后重试!');  
142 - } 139 +// $route_array = Translate::tran($this->param['title'], 'en');
  140 +// if (empty($route_array)) {
  141 +// $this->fail('路由生成失败,请稍后重试!');
  142 +// }
143 $num = count($this->param['title']); 143 $num = count($this->param['title']);
144 if($num > 1000){ 144 if($num > 1000){
145 $this->fail('最大数量不能超过1000'); 145 $this->fail('最大数量不能超过1000');
@@ -150,18 +150,19 @@ class KeywordLogic extends BaseLogic @@ -150,18 +150,19 @@ class KeywordLogic extends BaseLogic
150 } 150 }
151 $this->model = new Keyword(); 151 $this->model = new Keyword();
152 $info = $this->model->read(['title'=>$v]); 152 $info = $this->model->read(['title'=>$v]);
153 - if($info === false){  
154 -// $route = $this->specialRouteCheck($v); 153 + if($info !== false) {
  154 + continue;
  155 + }
155 $param['project_id'] = $this->user['project_id']; 156 $param['project_id'] = $this->user['project_id'];
156 $param['created_at'] = date('Y-m-d H:i:s'); 157 $param['created_at'] = date('Y-m-d H:i:s');
157 $param['updated_at'] = $param['created_at']; 158 $param['updated_at'] = $param['created_at'];
158 $param['title'] = $v; 159 $param['title'] = $v;
159 -// $param['route'] = $route;  
160 $id = $this->model->insertGetId($param); 160 $id = $this->model->insertGetId($param);
161 - $route = RouteMap::setRoute($route_array[$k], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);  
162 -// $this->curlDelRoute(['new_route'=>$route]);  
163 - $this->model->edit(['route'=>$route],['id'=>$id]); 161 + $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  162 + if(!empty($route)){
  163 + $this->fail('路由生成失败,请稍后重试!');
164 } 164 }
  165 + $this->model->edit(['route'=>$route],['id'=>$id]);
165 } 166 }
166 return $this->success(); 167 return $this->success();
167 } 168 }