fix: 删除系统管理员失效的问题

This commit is contained in:
chenzifan 2024-03-13 08:45:09 +08:00
parent f80fe6d041
commit cc6f140812

View File

@ -135,9 +135,15 @@ func (h *SysUserHandler) ResetPass(c *gin.Context) {
// Remove 删除
func (h *SysUserHandler) Remove(c *gin.Context) {
id := h.GetInt(c, "id", 0)
if id > 0 {
res := h.db.Where("id = ?", id).Delete(&model.AdminUser{})
var data struct {
Id uint
}
if err := c.ShouldBindJSON(&data); err != nil {
resp.ERROR(c, types.InvalidArgs)
return
}
if data.Id > 0 {
res := h.db.Where("id = ?", data.Id).Delete(&model.AdminUser{})
if res.Error != nil {
resp.ERROR(c, "删除失败")
return