作者 lyh

gx

... ... @@ -105,20 +105,16 @@ class KeywordLogic extends BaseLogic
* @time :2023/8/28 14:03
*/
public function batchAdd(){
if(!empty($this->param['title']) && is_array($this->param['title'])){
foreach ($this->param['title'] as $v){
$newStr = str_replace(' ', '-', $v);
$info = $this->model->read(['title'=>$newStr]);
$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'] = $newStr;
$param['title'] = $v;
$id = $this->model->insertGetId($param);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($id.'---'.$newStr, true) . PHP_EOL, FILE_APPEND);
$route = RouteMap::setRoute($newStr, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
// $route = RouteMap::setRoute($newStr, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
// $this->model->edit(['route'=>$route],['id'=>$id]);
}
}
return $this->success();
... ...