修复通道提取接口权限与数据映射问题

This commit is contained in:
2025-12-01 12:43:29 +08:00
parent 299ce821d5
commit a024c38375
11 changed files with 124 additions and 198 deletions

View File

@@ -56,7 +56,8 @@ func ListChannels(c *fiber.Ctx) error {
}
// 查询数据
channels, err := q.Channel.Debug().
channels, err := q.Channel.
Preload(q.Channel.Proxy).
Where(cond).
Order(q.Channel.CreatedAt.Desc()).
Offset(req.GetOffset()).
@@ -110,17 +111,6 @@ type CreateChannelRespItem struct {
func CreateChannel(c *fiber.Ctx) error {
// 检查权限
authCtx, err := auth.GetAuthCtx(c).PermitUser()
if err != nil {
return err
}
user := authCtx.User
if user.IDToken == nil || *user.IDToken == "" {
return fiber.NewError(fiber.StatusForbidden, "账号未实名")
}
// 解析参数
req := new(CreateChannelReq)
if err := g.Validator.Validate(c, req); err != nil {
@@ -135,7 +125,6 @@ func CreateChannel(c *fiber.Ctx) error {
// 创建通道
result, err := s.Channel.CreateChannels(
ip,
user.ID,
req.ResourceId,
req.AuthType == s.ChannelAuthTypeIp,
req.AuthType == s.ChannelAuthTypePass,