重构增加模型枚举值定义

This commit is contained in:
2025-05-09 18:56:17 +08:00
parent d5a242d6b4
commit 071a0e1a6c
29 changed files with 252 additions and 138 deletions

View File

@@ -15,6 +15,8 @@ import (
"platform/pkg/u"
"platform/web/auth"
"platform/web/core"
channel2 "platform/web/domains/channel"
proxy2 "platform/web/domains/proxy"
g "platform/web/globals"
m "platform/web/models"
q "platform/web/queries"
@@ -214,7 +216,7 @@ func (s *channelService) CreateChannel(
ctx context.Context,
authCtx *auth.Context,
resourceId int32,
protocol ChannelProtocol,
protocol channel2.Protocol,
authType ChannelAuthType,
count int,
nodeFilter ...NodeFilterConfig,
@@ -340,7 +342,7 @@ func findResource(q *q.Query, resourceId int32, authCtx *auth.Context, count int
func findProxies(q *q.Query) (proxies []*m.Proxy, err error) {
proxies, err = q.Proxy.
Where(q.Proxy.Type.Eq(1)).
Where(q.Proxy.Type.Eq(int32(proxy2.TypeThirdParty))).
Find()
if err != nil {
return nil, err
@@ -394,7 +396,7 @@ func calcChannels(
whitelist *[]string,
count int,
userId int32,
protocol ChannelProtocol,
protocol channel2.Protocol,
authType ChannelAuthType,
expiration time.Time,
filter NodeFilterConfig,
@@ -700,15 +702,6 @@ const (
ChannelAuthTypePass
)
type ChannelProtocol int32
const (
ProtocolAll ChannelProtocol = iota
ProtocolHTTP
ProtocolHttps
ProtocolSocks5
)
type ChannelServiceErr string
func (c ChannelServiceErr) Error() string {