|
...
|
...
|
@@ -29,31 +29,18 @@ class KeywordPrefixLogic extends BaseLogic |
|
|
|
* @time :2023/9/6 14:42
|
|
|
|
*/
|
|
|
|
public function prefixSave(){
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$condition = [
|
|
|
|
'keyword'=>$this->param['keyword'],
|
|
|
|
'id'=>['!=',$this->param['id']]
|
|
|
|
];
|
|
|
|
$prefixInfo = $this->model->read($condition);
|
|
|
|
if($prefixInfo !== false){
|
|
|
|
$this->fail('当前关键字已存在');
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'keyword'=>$this->param['keyword']
|
|
|
|
];
|
|
|
|
$this->model->edit($data,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$keyword_arr = explode(',',$this->param['keyword']);
|
|
|
|
foreach ($keyword_arr as $v){
|
|
|
|
$data = [
|
|
|
|
'project_id'=>$this->param['project_id'] ?? 0,
|
|
|
|
'keyword'=>$this->param['keyword'],
|
|
|
|
'keyword'=>$v,
|
|
|
|
'type'=>$this->param['type']
|
|
|
|
];
|
|
|
|
$prefixInfo = $this->model->read($data);
|
|
|
|
if($prefixInfo !== false){
|
|
|
|
$this->fail('当前关键字已存在');
|
|
|
|
}
|
|
|
|
if($prefixInfo == false){
|
|
|
|
$this->model->add($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|