From 0b00e6f4d81c7e38f217bcc9df866eaa93647a6c Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Sat, 24 Feb 2018 13:06:20 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E8=8F=9C=E5=8D=95=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Menu.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/Menu.php b/application/admin/controller/Menu.php index 24f2474..de7e865 100644 --- a/application/admin/controller/Menu.php +++ b/application/admin/controller/Menu.php @@ -20,7 +20,7 @@ class Menu extends Base { * @author zhaoxiang */ public function index() { - $list = (new ApiMenu)->where([])->order('sort', 'ASC')->select(); + $list = (new ApiMenu)->where([])->order('sort', 'DESC')->select(); $list = $this->buildArrFromObj($list); $list = formatTree(listToTree($list)); @@ -36,6 +36,9 @@ class Menu extends Base { */ public function add() { $postData = $this->request->post(); + if ($postData['url']) { + $postData['url'] = 'admin/' . $postData['url']; + } $res = ApiMenu::create($postData); if ($res === false) { return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败'); @@ -93,6 +96,7 @@ class Menu extends Base { return $this->buildFailed(ReturnCode::INVALID, '当前菜单存在子菜单,不可以被删除!'); } else { ApiMenu::destroy($id); + return $this->buildSuccess([]); } }