From dc3722b9811a8395aee0dedf3ad1946c67d7b277 Mon Sep 17 00:00:00 2001 From: WispX <1591788658@qq.com> Date: Sat, 19 Jan 2019 22:45:02 +0800 Subject: [PATCH] fix --- .env | 4 ---- application/index/controller/admin/Group.php | 6 ++++++ application/index/view/admin/group/index.html | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 6acdc4bd..00000000 --- a/.env +++ /dev/null @@ -1,4 +0,0 @@ -[APP] -NAME = Lsky Pro -DEBUG = false -TRACE = false diff --git a/application/index/controller/admin/Group.php b/application/index/controller/admin/Group.php index ae7caf2b..936d12fa 100644 --- a/application/index/controller/admin/Group.php +++ b/application/index/controller/admin/Group.php @@ -66,6 +66,12 @@ class Group extends Base if (true !== $validate) { throw new Exception($validate); } + $data['default'] = array_key_exists('default', $data) ? 1 : 0; + if ($data['default'] === 0) { + if (!GroupModel::where('default', 1)->where('id', 'neq', $data['id'])->count()) { + throw new Exception('至少保留一个默认分组'); + } + } if (!GroupModel::update($data)) { throw new Exception('编辑失败'); } diff --git a/application/index/view/admin/group/index.html b/application/index/view/admin/group/index.html index bbe8520c..07df60a7 100644 --- a/application/index/view/admin/group/index.html +++ b/application/index/view/admin/group/index.html @@ -88,7 +88,7 @@
添加角色组
- +