- 修复更新后出现重复的默认组的bug

- 禁止删除默认组
This commit is contained in:
wispx
2019-03-06 10:26:19 +08:00
parent 3af308ffa3
commit aeffcc9348
2 changed files with 4 additions and 1 deletions
@@ -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');