mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-06 01:03:43 +08:00
fix: 删除系统管理员失效的问题
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
|||||||
"chatplus/store/vo"
|
"chatplus/store/vo"
|
||||||
"chatplus/utils"
|
"chatplus/utils"
|
||||||
"chatplus/utils/resp"
|
"chatplus/utils/resp"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@@ -150,15 +149,12 @@ func (h *SysUserHandler) Remove(c *gin.Context) {
|
|||||||
resp.ERROR(c, types.InvalidArgs)
|
resp.ERROR(c, types.InvalidArgs)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if data.Id > 0 {
|
|
||||||
|
|
||||||
// 默认id为1是超级管理员
|
// 默认id为1是超级管理员
|
||||||
if data.Id == 1 {
|
if data.Id == 1 {
|
||||||
resp.ERROR(c, "超级管理员不能删除")
|
resp.ERROR(c, "超级管理员不能删除")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if data.Id > 0 {
|
||||||
|
|
||||||
res := h.db.Where("id = ?", data.Id).Delete(&model.AdminUser{})
|
res := h.db.Where("id = ?", data.Id).Delete(&model.AdminUser{})
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
resp.ERROR(c, "删除失败")
|
resp.ERROR(c, "删除失败")
|
||||||
|
|||||||
Reference in New Issue
Block a user