diff --git a/app/admin/hdl/hdl_role.go b/app/admin/hdl/hdl_role.go index 76a1422..38e4a8c 100644 --- a/app/admin/hdl/hdl_role.go +++ b/app/admin/hdl/hdl_role.go @@ -424,6 +424,15 @@ func AddAdmin(c *gin.Context) { } admDb := db.AdminDb{} admDb.Set() + isHasAdmin, err := admDb.GetAdminByUserName(req.Username) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if isHasAdmin != nil { + e.OutErr(c, e.ERR, "当前用户名已存在,请勿重复添加") + return + } admId, err := admDb.CreateAdminId() if err != nil {