feat:完善项目

This commit is contained in:
henry
2021-11-17 11:11:39 +08:00
parent 48319d9632
commit 09cc956d42
10 changed files with 196 additions and 27 deletions

View File

@ -254,6 +254,15 @@ func (c *Instance) Form(params *InstanceParams) error {
func (c *Instance) Delete(id uint64) error {
mSysUser := model.NewSysUser()
mSysUser.ID = id
isExist, err := model2.FirstField(mSysUser.SysUser, []string{"id", "is_admin"})
if err != nil {
return err
} else if !isExist {
return errors.New("操作错误,用户信息不存在或已被删除")
} else if mSysUser.IsAdminUser() {
return errors.New("操作错误,超管不可删除")
}
return model2.Delete(mSysUser.SysUser)
}