|
...
|
...
|
@@ -107,14 +107,17 @@ class KeywordLogic extends BaseLogic |
|
|
|
public function batchAdd(){
|
|
|
|
if(!empty($this->param['title']) && is_array($this->param['title'])){
|
|
|
|
foreach ($this->param['title'] as $v){
|
|
|
|
$param['project_id'] = $this->user['project_id'];
|
|
|
|
$param['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$param['updated_at'] = $param['created_at'];
|
|
|
|
$param['title'] = $v;
|
|
|
|
$id = $this->model->insertGetId($param);
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($id.'---'.$v, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
$info = $this->model->read(['title'=>$v]);
|
|
|
|
if($info === false){
|
|
|
|
$param['project_id'] = $this->user['project_id'];
|
|
|
|
$param['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$param['updated_at'] = $param['created_at'];
|
|
|
|
$param['title'] = $v;
|
|
|
|
$id = $this->model->insertGetId($param);
|
|
|
|
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($id.'---'.$v, true) . PHP_EOL, FILE_APPEND);
|
|
|
|
$route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
|
|
|
|
$this->model->edit(['route'=>$route],['id'=>$id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
...
|
...
|
|