|
@@ -50,15 +50,17 @@ class KeywordPrefixLogic extends BaseLogic |
|
@@ -50,15 +50,17 @@ class KeywordPrefixLogic extends BaseLogic |
|
50
|
* @time :2023/12/16 13:48
|
50
|
* @time :2023/12/16 13:48
|
|
51
|
*/
|
51
|
*/
|
|
52
|
public function prefixDel(){
|
52
|
public function prefixDel(){
|
|
53
|
- $info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
54
|
- if($info === false){
|
|
|
|
55
|
- $this->fail('当前数据不存在,或已被删除');
|
53
|
+ $ids = $this->param['id'];
|
|
|
|
54
|
+ try {
|
|
|
|
55
|
+ foreach ($ids as $id){
|
|
|
|
56
|
+ $info = $this->model->read(['id'=>$id]);
|
|
|
|
57
|
+ if($info !== false){
|
|
|
|
58
|
+ if($info['project_id'] != 0){
|
|
|
|
59
|
+ $this->model->del(['id'=>$id]);
|
|
|
|
60
|
+ }
|
|
56
|
}
|
61
|
}
|
|
57
|
- if($info['project_id'] == 0){
|
|
|
|
58
|
- $this->fail('不允许删除');
|
|
|
|
59
|
}
|
62
|
}
|
|
60
|
- $rs = $this->model->del(['id'=>$this->param['id']]);
|
|
|
|
61
|
- if($rs === false){
|
63
|
+ }catch (\Exception $e){
|
|
62
|
$this->fail('删除失败,请联系管理员');
|
64
|
$this->fail('删除失败,请联系管理员');
|
|
63
|
}
|
65
|
}
|
|
64
|
return $this->success();
|
66
|
return $this->success();
|