|
...
|
...
|
@@ -41,14 +41,7 @@ class BlogLabelLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function add_blog_label(){
|
|
|
|
$condition = [
|
|
|
|
'name'=>$this->param['name']
|
|
|
|
];
|
|
|
|
//查看当前分类名称是否存在
|
|
|
|
$info = $this->model->read($condition);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前标签名称已存在');
|
|
|
|
}
|
|
|
|
$this->verifyParamName($this->param['name']);
|
|
|
|
$this->param['create_id'] = $this->user['id'];
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
...
|
...
|
@@ -66,17 +59,12 @@ class BlogLabelLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function edit_blog_label(){
|
|
|
|
$condition = [
|
|
|
|
'id'=>['!=',$this->param['id']],
|
|
|
|
'name'=>$this->param['name']
|
|
|
|
];
|
|
|
|
//查看当前分类名称是否存在
|
|
|
|
$info = $this->model->read($condition);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前标签名称已存在');
|
|
|
|
}
|
|
|
|
$this->verifyParamName($this->param['name'],$this->param['id']);
|
|
|
|
$this->param['operator_id'] = $this->user['id'];
|
|
|
|
$this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
$rs = $this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -111,4 +99,51 @@ class BlogLabelLogic extends BaseLogic |
|
|
|
$this->del($this->param,$ids);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :批量添加数据
|
|
|
|
* @name :batchAdd
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/28 14:03
|
|
|
|
*/
|
|
|
|
public function batchAdd(){
|
|
|
|
$ids = [];
|
|
|
|
if(!empty($this->param['title']) && is_array($this->param['title'])){
|
|
|
|
foreach ($this->param['title'] as $v){
|
|
|
|
$this->verifyParamName($v);
|
|
|
|
$param['create_id'] = $this->user['id'];
|
|
|
|
$param['operator_id'] = $this->user['id'];
|
|
|
|
$param['project_id'] = $this->user['project_id'];
|
|
|
|
$param['title'] = $v;
|
|
|
|
$id = $this->model->insertGetId($param);
|
|
|
|
$ids[] = $id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($ids);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :(验证名称是否存在)verifyParamName
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/13 11:41
|
|
|
|
*/
|
|
|
|
public function verifyParamName($name,$id = ''){
|
|
|
|
if(isset($id) && !empty($id)){
|
|
|
|
$condition = [
|
|
|
|
'id'=>['!=',$id],
|
|
|
|
'name'=>$name,
|
|
|
|
];
|
|
|
|
}else{
|
|
|
|
$condition = [
|
|
|
|
'name'=>$name
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$info = $this->model->read($condition);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前名称已存在');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|