From b1fd6a1f568da5e50117cf1e18dd0b4ae1d300bf Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Thu, 10 Nov 2016 00:10:43 +0800 Subject: [PATCH] =?UTF-8?q?added=20=E6=96=B0=E5=A2=9E=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Menu.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/Menu.php b/application/admin/controller/Menu.php index 0345cec..9551770 100644 --- a/application/admin/controller/Menu.php +++ b/application/admin/controller/Menu.php @@ -396,7 +396,18 @@ class Menu extends Base { } public function del(){ - $this->error('失败'); + if( $this->request->isDelete() ){ + $key = $this->request->delete($this->primaryKey); + $childNum = \app\admin\model\Menu::where(['fid' => $key])->count(); + if( $childNum ){ + $this->error('当前菜单存在子菜单,删除失败!'); + } + $delNum = \app\admin\model\Menu::destroy($key); + if( $delNum ){ + $this->success('操作成功!', url('Menu/index')); + } + } + $this->error('操作失败!'); } } \ No newline at end of file