mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 02:03:42 +08:00
Merge remote-tracking branch 'origin/ui' into ui
# Conflicts: # api/handler/admin/admin_user_handler.go
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"chatplus/store/vo"
|
||||
"chatplus/utils"
|
||||
"chatplus/utils/resp"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -73,6 +74,13 @@ func (h *SysUserHandler) Save(c *gin.Context) {
|
||||
resp.ERROR(c, types.InvalidArgs)
|
||||
return
|
||||
}
|
||||
|
||||
// 默认id为1是超级管理员
|
||||
if data.Id == 1 {
|
||||
resp.ERROR(c, "超级管理员不支持更新")
|
||||
return
|
||||
}
|
||||
|
||||
var user = model.AdminUser{}
|
||||
var res *gorm.DB
|
||||
var userVo vo.AdminUser
|
||||
@@ -143,6 +151,14 @@ func (h *SysUserHandler) Remove(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if data.Id > 0 {
|
||||
|
||||
// 默认id为1是超级管理员
|
||||
if data.Id == 1 {
|
||||
resp.ERROR(c, "超级管理员不能删除")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
res := h.db.Where("id = ?", data.Id).Delete(&model.AdminUser{})
|
||||
if res.Error != nil {
|
||||
resp.ERROR(c, "删除失败")
|
||||
|
||||
Reference in New Issue
Block a user