v1.1
This commit is contained in:
@@ -28,9 +28,9 @@ func NewAdminRemoveRoleApiLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
|
||||
func (l *AdminRemoveRoleApiLogic) AdminRemoveRoleApi(req *types.AdminRemoveRoleApiReq) (resp *types.AdminRemoveRoleApiResp, err error) {
|
||||
// 1. 参数验证
|
||||
if req.RoleId <= 0 {
|
||||
if req.RoleId == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
"角色ID必须大于0, roleId: %d", req.RoleId)
|
||||
"角色ID不能为空, roleId: %s", req.RoleId)
|
||||
}
|
||||
if len(req.ApiIds) == 0 {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.PARAM_VERIFICATION_ERROR),
|
||||
@@ -51,7 +51,7 @@ func (l *AdminRemoveRoleApiLogic) AdminRemoveRoleApi(req *types.AdminRemoveRoleA
|
||||
// 3. 批量移除API权限
|
||||
successCount := 0
|
||||
for _, apiId := range req.ApiIds {
|
||||
if apiId <= 0 {
|
||||
if apiId == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func (l *AdminRemoveRoleApiLogic) AdminRemoveRoleApi(req *types.AdminRemoveRoleA
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
continue // 不存在,跳过
|
||||
}
|
||||
logx.Errorf("查询角色API关联失败, err: %v, roleId: %d, apiId: %d", err, req.RoleId, apiId)
|
||||
logx.Errorf("查询角色API关联失败, err: %v, roleId: %s, apiId: %s", err, req.RoleId, apiId)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user