重构错误处理逻辑,使用 fiber.Error 统一返回错误状态码;统一授权枚举值定义到 auth 包
This commit is contained in:
@@ -67,7 +67,7 @@ func (s *channelService) RemoveChannels(ctx context.Context, authCtx *auth.Conte
|
||||
// 检查权限,如果为用户操作的话,则只能删除自己的通道
|
||||
for _, channel := range channels {
|
||||
if authCtx.Payload.Type == auth.PayloadUser && authCtx.Payload.Id != channel.UserID {
|
||||
return core.ForbiddenErr("无权限访问")
|
||||
return core.ErrForbidden()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user