完善 channel create 测试用例

This commit is contained in:
2025-04-03 16:39:57 +08:00
parent 175f55c24f
commit 9d8850aec1
4 changed files with 489 additions and 78 deletions

View File

@@ -269,7 +269,8 @@ func (s *channelService) CreateChannel(
Scan(&resource)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return ChannelServiceErr("套餐不存在")
// 禁止 id 猜测
return ChannelServiceErr("无权限访问")
}
return err
}
@@ -417,7 +418,7 @@ func assignEdge(q *q.Query, count int, filter NodeFilterConfig) (*AssignEdgeResu
for i, proxy := range proxies {
proxyIds[i] = proxy.ID
}
channels, err := q.Channel.
channels, err := q.Channel.Debug().
Select(
q.Channel.ProxyID,
q.Channel.ProxyPort).
@@ -661,8 +662,6 @@ func assignPort(
Omit(
q.Channel.NodeID,
q.Channel.NodeHost,
q.Channel.Username,
q.Channel.Password,
q.Channel.DeletedAt,
).
Save(channels...)