作者 lyh

gx

... ... @@ -60,7 +60,7 @@ class KeywordPrefixController extends BaseController
*/
public function del(KeywordPrefixLogic $keywordPrefixLogic){
$this->request->validate([
'id'=>'required',
'id'=>'required|array',
],[
'id.required' => 'id不能为空',
]);
... ...
... ... @@ -50,15 +50,17 @@ class KeywordPrefixLogic extends BaseLogic
* @time :2023/12/16 13:48
*/
public function prefixDel(){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在,或已被删除');
$ids = $this->param['id'];
try {
foreach ($ids as $id){
$info = $this->model->read(['id'=>$id]);
if($info !== false){
if($info['project_id'] != 0){
$this->model->del(['id'=>$id]);
}
}
if($info['project_id'] == 0){
$this->fail('不允许删除');
}
$rs = $this->model->del(['id'=>$this->param['id']]);
if($rs === false){
}catch (\Exception $e){
$this->fail('删除失败,请联系管理员');
}
return $this->success();
... ...