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
0084da9c
Commit
0084da9c
authored
Dec 28, 2025
by
shaw
Browse files
fix: 修复 NewSettingHandler 参数不足导致的编译错误
- 测试文件添加第三个参数 userService(nil) - Handler 添加 userService 空指针检查,防止测试环境 panic
parent
31d4c1d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/setting_handler.go
View file @
0084da9c
...
...
@@ -150,7 +150,7 @@ func (h *SettingHandler) UpdateSettings(c *gin.Context) {
}
// 如果切换到简单模式,自动将管理员并发数设为 99999
if
req
.
SimpleMode
{
if
req
.
SimpleMode
&&
h
.
userService
!=
nil
{
admin
,
err
:=
h
.
userService
.
GetFirstAdmin
(
c
.
Request
.
Context
())
if
err
==
nil
&&
admin
!=
nil
{
_
=
h
.
userService
.
UpdateConcurrency
(
c
.
Request
.
Context
(),
admin
.
ID
,
99999
)
...
...
backend/internal/server/api_contract_test.go
View file @
0084da9c
...
...
@@ -383,7 +383,7 @@ func newContractDeps(t *testing.T) *contractDeps {
authHandler
:=
handler
.
NewAuthHandler
(
nil
,
userService
)
apiKeyHandler
:=
handler
.
NewAPIKeyHandler
(
apiKeyService
)
usageHandler
:=
handler
.
NewUsageHandler
(
usageService
,
apiKeyService
)
adminSettingHandler
:=
adminhandler
.
NewSettingHandler
(
settingService
,
nil
)
adminSettingHandler
:=
adminhandler
.
NewSettingHandler
(
settingService
,
nil
,
nil
)
jwtAuth
:=
func
(
c
*
gin
.
Context
)
{
c
.
Set
(
string
(
middleware
.
ContextKeyUser
),
middleware
.
AuthSubject
{
...
...
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