From aeffcc9348d86a654e4b810fe8f6aaf66f74963d Mon Sep 17 00:00:00 2001 From: wispx <1591788658@qq.com> Date: Wed, 6 Mar 2019 10:26:19 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=8E=E5=87=BA=E7=8E=B0=E9=87=8D=E5=A4=8D=E7=9A=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=BB=84=E7=9A=84bug=20-=20=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=BB=98=E8=AE=A4=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/admin/Group.php | 3 +++ update.sql | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/application/index/controller/admin/Group.php b/application/index/controller/admin/Group.php index 07304460..0eada815 100644 --- a/application/index/controller/admin/Group.php +++ b/application/index/controller/admin/Group.php @@ -88,6 +88,9 @@ class Group extends Base Db::startTrans(); try { $id = $this->request->post('id'); + if (1 == $id) { + throw new Exception('默认组不可删除'); + } $group = GroupModel::find($id); // 至少保留一个默认分组 $defaultId = GroupModel::where('default', 1)->where('id', 'neq', $id)->value('id'); diff --git a/update.sql b/update.sql index 960cfd09..2b6f3a8a 100644 --- a/update.sql +++ b/update.sql @@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS `lsky_group` ( `create_time` int(11) DEFAULT NULL COMMENT '添加时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci COMMENT='文件夹表'; -INSERT IGNORE INTO `lsky_group` (`id`, `strategy`, `name`, `default`, `update_time`, `create_time`) VALUES (NULL, 'local', '默认组', '1', '0', '0'); +INSERT IGNORE INTO `lsky_group` (`id`, `strategy`, `name`, `default`, `create_time`) VALUES ('1', 'local', '默认组', '1', '0'); -- v1.5.1 UPDATE `lsky_config` SET `value` = '1.5.1' WHERE `lsky_config`.`name` = 'system_version';