Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
983fe589
Commit
983fe589
authored
Mar 30, 2026
by
erio
Browse files
fix: CI lint/test fixes — gofmt, errcheck, handler test args
parent
91c9b8d0
Changes
8
Show whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/channel_handler.go
View file @
983fe589
backend/internal/handler/gateway_handler_warmup_intercept_unit_test.go
View file @
983fe589
...
@@ -161,6 +161,7 @@ func newTestGatewayHandler(t *testing.T, group *service.Group, accounts []*servi
...
@@ -161,6 +161,7 @@ func newTestGatewayHandler(t *testing.T, group *service.Group, accounts []*servi
nil
,
// digestStore
nil
,
// digestStore
nil
,
// settingService
nil
,
// settingService
nil
,
// tlsFPProfileService
nil
,
// tlsFPProfileService
nil
,
// channelService
)
)
// RunModeSimple:跳过计费检查,避免引入 repo/cache 依赖。
// RunModeSimple:跳过计费检查,避免引入 repo/cache 依赖。
...
...
backend/internal/handler/sora_client_handler_test.go
View file @
983fe589
...
@@ -2224,7 +2224,7 @@ func (s *stubSoraClientForHandler) GetVideoTask(_ context.Context, _ *service.Ac
...
@@ -2224,7 +2224,7 @@ func (s *stubSoraClientForHandler) GetVideoTask(_ context.Context, _ *service.Ac
func
newMinimalGatewayService
(
accountRepo
service
.
AccountRepository
)
*
service
.
GatewayService
{
func
newMinimalGatewayService
(
accountRepo
service
.
AccountRepository
)
*
service
.
GatewayService
{
return
service
.
NewGatewayService
(
return
service
.
NewGatewayService
(
accountRepo
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
accountRepo
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
nil
,
)
)
}
}
...
...
backend/internal/handler/sora_gateway_handler_test.go
View file @
983fe589
...
@@ -465,6 +465,7 @@ func TestSoraGatewayHandler_ChatCompletions(t *testing.T) {
...
@@ -465,6 +465,7 @@ func TestSoraGatewayHandler_ChatCompletions(t *testing.T) {
nil
,
// digestStore
nil
,
// digestStore
nil
,
// settingService
nil
,
// settingService
nil
,
// tlsFPProfileService
nil
,
// tlsFPProfileService
nil
,
// channelService
)
)
soraClient
:=
&
stubSoraClient
{
imageURLs
:
[]
string
{
"https://example.com/a.png"
}}
soraClient
:=
&
stubSoraClient
{
imageURLs
:
[]
string
{
"https://example.com/a.png"
}}
...
...
backend/internal/repository/channel_repo.go
View file @
983fe589
...
@@ -186,7 +186,7 @@ func (r *channelRepository) List(ctx context.Context, params pagination.Paginati
...
@@ -186,7 +186,7 @@ func (r *channelRepository) List(ctx context.Context, params pagination.Paginati
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
fmt
.
Errorf
(
"query channels: %w"
,
err
)
return
nil
,
nil
,
fmt
.
Errorf
(
"query channels: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
var
channels
[]
service
.
Channel
var
channels
[]
service
.
Channel
var
channelIDs
[]
int64
var
channelIDs
[]
int64
...
@@ -240,7 +240,7 @@ func (r *channelRepository) ListAll(ctx context.Context) ([]service.Channel, err
...
@@ -240,7 +240,7 @@ func (r *channelRepository) ListAll(ctx context.Context) ([]service.Channel, err
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"query all channels: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"query all channels: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
var
channels
[]
service
.
Channel
var
channels
[]
service
.
Channel
var
channelIDs
[]
int64
var
channelIDs
[]
int64
...
@@ -292,7 +292,7 @@ func (r *channelRepository) batchLoadGroupIDs(ctx context.Context, channelIDs []
...
@@ -292,7 +292,7 @@ func (r *channelRepository) batchLoadGroupIDs(ctx context.Context, channelIDs []
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"batch load group ids: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"batch load group ids: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
groupMap
:=
make
(
map
[
int64
][]
int64
,
len
(
channelIDs
))
groupMap
:=
make
(
map
[
int64
][]
int64
,
len
(
channelIDs
))
for
rows
.
Next
()
{
for
rows
.
Next
()
{
...
@@ -333,7 +333,7 @@ func (r *channelRepository) GetGroupIDs(ctx context.Context, channelID int64) ([
...
@@ -333,7 +333,7 @@ func (r *channelRepository) GetGroupIDs(ctx context.Context, channelID int64) ([
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"get group ids: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"get group ids: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
var
ids
[]
int64
var
ids
[]
int64
for
rows
.
Next
()
{
for
rows
.
Next
()
{
...
@@ -375,7 +375,7 @@ func (r *channelRepository) GetGroupsInOtherChannels(ctx context.Context, channe
...
@@ -375,7 +375,7 @@ func (r *channelRepository) GetGroupsInOtherChannels(ctx context.Context, channe
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"get groups in other channels: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"get groups in other channels: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
var
conflicting
[]
int64
var
conflicting
[]
int64
for
rows
.
Next
()
{
for
rows
.
Next
()
{
...
...
backend/internal/repository/channel_repo_pricing.go
View file @
983fe589
...
@@ -21,7 +21,7 @@ func (r *channelRepository) ListModelPricing(ctx context.Context, channelID int6
...
@@ -21,7 +21,7 @@ func (r *channelRepository) ListModelPricing(ctx context.Context, channelID int6
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"list model pricing: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"list model pricing: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
result
,
pricingIDs
,
err
:=
scanModelPricingRows
(
rows
)
result
,
pricingIDs
,
err
:=
scanModelPricingRows
(
rows
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -97,7 +97,7 @@ func (r *channelRepository) batchLoadModelPricing(ctx context.Context, channelID
...
@@ -97,7 +97,7 @@ func (r *channelRepository) batchLoadModelPricing(ctx context.Context, channelID
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"batch load model pricing: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"batch load model pricing: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
allPricing
,
allPricingIDs
,
err
:=
scanModelPricingRows
(
rows
)
allPricing
,
allPricingIDs
,
err
:=
scanModelPricingRows
(
rows
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -139,7 +139,7 @@ func (r *channelRepository) batchLoadIntervals(ctx context.Context, pricingIDs [
...
@@ -139,7 +139,7 @@ func (r *channelRepository) batchLoadIntervals(ctx context.Context, pricingIDs [
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"batch load intervals: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"batch load intervals: %w"
,
err
)
}
}
defer
rows
.
Close
()
defer
func
()
{
_
=
rows
.
Close
()
}()
intervalMap
:=
make
(
map
[
int64
][]
service
.
PricingInterval
,
len
(
pricingIDs
))
intervalMap
:=
make
(
map
[
int64
][]
service
.
PricingInterval
,
len
(
pricingIDs
))
for
rows
.
Next
()
{
for
rows
.
Next
()
{
...
...
backend/internal/service/billing_service.go
View file @
983fe589
backend/internal/service/channel.go
View file @
983fe589
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment