mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-20 18:26:37 +08:00
fix: 删除系统管理员失效的问题
This commit is contained in:
parent
f80fe6d041
commit
cc6f140812
@ -135,9 +135,15 @@ func (h *SysUserHandler) ResetPass(c *gin.Context) {
|
|||||||
|
|
||||||
// Remove 删除
|
// Remove 删除
|
||||||
func (h *SysUserHandler) Remove(c *gin.Context) {
|
func (h *SysUserHandler) Remove(c *gin.Context) {
|
||||||
id := h.GetInt(c, "id", 0)
|
var data struct {
|
||||||
if id > 0 {
|
Id uint
|
||||||
res := h.db.Where("id = ?", id).Delete(&model.AdminUser{})
|
}
|
||||||
|
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 {
|
if res.Error != nil {
|
||||||
resp.ERROR(c, "删除失败")
|
resp.ERROR(c, "删除失败")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user