|
...
|
...
|
@@ -105,6 +105,8 @@ class KeywordLogic extends BaseLogic |
|
|
|
* @time :2023/8/28 14:03
|
|
|
|
*/
|
|
|
|
public function batchAdd(){
|
|
|
|
try {
|
|
|
|
$idArr = [];
|
|
|
|
foreach ($this->param['title'] as $v){
|
|
|
|
$info = $this->model->read(['title'=>$v]);
|
|
|
|
if($info === false){
|
|
...
|
...
|
@@ -113,9 +115,16 @@ class KeywordLogic extends BaseLogic |
|
|
|
$param['updated_at'] = $param['created_at'];
|
|
|
|
$param['title'] = $v;
|
|
|
|
$id = $this->model->insertGetId($param);
|
|
|
|
$route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
|
|
|
|
$idArr[] = ['id'=>$id,'title'=>$v];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//批量生成路由
|
|
|
|
foreach ($idArr as $v){
|
|
|
|
$route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
...
|
...
|
|