CreateRole 创建新角色
(ctx context.Context, role *domain.Role, menuIds []int, apiIds []int)
| 41 | |
| 42 | // CreateRole 创建新角色 |
| 43 | func (r *roleService) CreateRole(ctx context.Context, role *domain.Role, menuIds []int, apiIds []int) error { |
| 44 | if role == nil { |
| 45 | r.l.Warn("角色不能为空") |
| 46 | return ErrInvalidRole |
| 47 | } |
| 48 | |
| 49 | return r.repo.CreateRole(ctx, role, menuIds, apiIds) |
| 50 | } |
| 51 | |
| 52 | // GetRoleById 根据ID获取角色信息 |
| 53 | func (r *roleService) GetRoleById(ctx context.Context, id int) (*domain.Role, error) { |
nothing calls this directly
no test coverage detected