|
...
|
...
|
@@ -126,7 +126,6 @@ class KeywordLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function batchAdd(){
|
|
|
|
try {
|
|
|
|
$idArr = [];
|
|
|
|
foreach ($this->param['title'] as $v){
|
|
|
|
$this->model = new Keyword();
|
|
|
|
$info = $this->model->read(['title'=>$v]);
|
|
...
|
...
|
@@ -136,15 +135,10 @@ class KeywordLogic extends BaseLogic |
|
|
|
$param['updated_at'] = $param['created_at'];
|
|
|
|
$param['title'] = $v;
|
|
|
|
$id = $this->model->insertGetId($param);
|
|
|
|
$idArr[] = ['id'=>$id,'title'=>$v];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//批量生成路由
|
|
|
|
foreach ($idArr as $v){
|
|
|
|
$this->model = new Keyword();
|
|
|
|
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']);
|
|
|
|
$route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
|
|
|
|
$this->curlDelRoute(['new_route'=>$route]);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('error');
|
...
|
...
|
|