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
c6e26c5a
"frontend/src/git@web.lueluesay.top:chenxi/sub2api.git" did not exist on "ecfad788d938832c3eacc38f5e9e6e1444c2eb50"
Commit
c6e26c5a
authored
Mar 01, 2026
by
Gemini Wen
Browse files
fix(group): clear nullable limit fields on update
parent
f7fa71bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/repository/group_repo.go
View file @
c6e26c5a
...
@@ -127,6 +127,38 @@ func (r *groupRepository) Update(ctx context.Context, groupIn *service.Group) er
...
@@ -127,6 +127,38 @@ func (r *groupRepository) Update(ctx context.Context, groupIn *service.Group) er
SetMcpXMLInject
(
groupIn
.
MCPXMLInject
)
.
SetMcpXMLInject
(
groupIn
.
MCPXMLInject
)
.
SetSoraStorageQuotaBytes
(
groupIn
.
SoraStorageQuotaBytes
)
SetSoraStorageQuotaBytes
(
groupIn
.
SoraStorageQuotaBytes
)
// 显式处理可空字段:nil 需要 clear,非 nil 需要 set。
if
groupIn
.
DailyLimitUSD
!=
nil
{
builder
=
builder
.
SetDailyLimitUsd
(
*
groupIn
.
DailyLimitUSD
)
}
else
{
builder
=
builder
.
ClearDailyLimitUsd
()
}
if
groupIn
.
WeeklyLimitUSD
!=
nil
{
builder
=
builder
.
SetWeeklyLimitUsd
(
*
groupIn
.
WeeklyLimitUSD
)
}
else
{
builder
=
builder
.
ClearWeeklyLimitUsd
()
}
if
groupIn
.
MonthlyLimitUSD
!=
nil
{
builder
=
builder
.
SetMonthlyLimitUsd
(
*
groupIn
.
MonthlyLimitUSD
)
}
else
{
builder
=
builder
.
ClearMonthlyLimitUsd
()
}
if
groupIn
.
ImagePrice1K
!=
nil
{
builder
=
builder
.
SetImagePrice1k
(
*
groupIn
.
ImagePrice1K
)
}
else
{
builder
=
builder
.
ClearImagePrice1k
()
}
if
groupIn
.
ImagePrice2K
!=
nil
{
builder
=
builder
.
SetImagePrice2k
(
*
groupIn
.
ImagePrice2K
)
}
else
{
builder
=
builder
.
ClearImagePrice2k
()
}
if
groupIn
.
ImagePrice4K
!=
nil
{
builder
=
builder
.
SetImagePrice4k
(
*
groupIn
.
ImagePrice4K
)
}
else
{
builder
=
builder
.
ClearImagePrice4k
()
}
// 处理 FallbackGroupID:nil 时清除,否则设置
// 处理 FallbackGroupID:nil 时清除,否则设置
if
groupIn
.
FallbackGroupID
!=
nil
{
if
groupIn
.
FallbackGroupID
!=
nil
{
builder
=
builder
.
SetFallbackGroupID
(
*
groupIn
.
FallbackGroupID
)
builder
=
builder
.
SetFallbackGroupID
(
*
groupIn
.
FallbackGroupID
)
...
...
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