From 6930bf87bdb7abac1ffff905532112b9f0e2b522 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 15 Sep 2023 11:25:27 +0800 Subject: [PATCH] update --- app/admin/hdl/hdl_role.go | 9 +++++++++ 1 file changed, 9 insertions(+) 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 {