1
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
昔念
2026-04-26 14:36:49 +08:00
parent 8e28e030c1
commit 1ff4381617
8 changed files with 30 additions and 24 deletions

View File

@@ -159,7 +159,7 @@ func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, pa
// 禁止删除超级管理员
userIds := garray.NewIntArrayFrom(gconv.Ints(param["ids"]))
currentId, found := userIds.Get(0)
superAdminId := 10001
superAdminId := int(SuperAdminUserID)
if userIds.Len() == 1 && found && currentId == superAdminId {
err = gerror.New("超级管理员不能删除")
@@ -167,7 +167,7 @@ func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, pa
}
// 删除超级管理员
userIds.RemoveValue(10001)
userIds.RemoveValue(superAdminId)
g.RequestFromCtx(ctx).SetParam("ids", userIds.Slice())
}
return
@@ -419,7 +419,7 @@ func (s *BaseSysUserService) ServiceUpdate(ctx context.Context, req *cool.Update
}
// 禁止禁用超级管理员
if userId == 10001 && (!r.Get("status").IsNil() && r.Get("status").Int() == 0) {
if userId == SuperAdminUserID && (!r.Get("status").IsNil() && r.Get("status").Int() == 0) {
err = gerror.New("禁止禁用超级管理员")
return
}
@@ -545,7 +545,7 @@ func NewBaseSysUserService() *BaseSysUserService {
Where: func(ctx context.Context) []g.Array {
r := g.RequestFromCtx(ctx).GetMap()
return []g.Array{
{"id != ?", g.Slice{"10001"}, true}, //排除管理员
{"id != ?", g.Slice{gconv.String(SuperAdminUserID)}, true}, //排除管理员
{`("departmentId" IN (?))`, gconv.SliceStr(r["departmentIds"])},
}
},