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
bf2b5902
Unverified
Commit
bf2b5902
authored
Apr 07, 2026
by
Wesley Liddick
Committed by
GitHub
Apr 07, 2026
Browse files
Merge pull request #1397 from weak-fox/fix/active-filter-excludes-rate-limited
解决账号管理中“正常”筛选包含限流中账号
parents
339d906e
a61d5871
Changes
2
Show whitespace changes
Inline
Side-by-side
backend/internal/repository/account_repo.go
View file @
bf2b5902
...
...
@@ -468,6 +468,14 @@ func (r *accountRepository) ListWithFilters(ctx context.Context, params paginati
}
if
status
!=
""
{
switch
status
{
case
service
.
StatusActive
:
q
=
q
.
Where
(
dbaccount
.
StatusEQ
(
status
),
dbaccount
.
Or
(
dbaccount
.
RateLimitResetAtIsNil
(),
dbaccount
.
RateLimitResetAtLTE
(
time
.
Now
()),
),
)
case
"rate_limited"
:
q
=
q
.
Where
(
dbaccount
.
RateLimitResetAtGT
(
time
.
Now
()))
case
"temp_unschedulable"
:
...
...
backend/internal/repository/account_repo_integration_test.go
View file @
bf2b5902
...
...
@@ -255,6 +255,22 @@ func (s *AccountRepoSuite) TestListWithFilters() {
s
.
Require
()
.
Equal
(
service
.
StatusDisabled
,
accounts
[
0
]
.
Status
)
},
},
{
name
:
"filter_by_status_active_excludes_rate_limited"
,
setup
:
func
(
client
*
dbent
.
Client
)
{
mustCreateAccount
(
s
.
T
(),
client
,
&
service
.
Account
{
Name
:
"active-normal"
,
Status
:
service
.
StatusActive
})
rateLimited
:=
mustCreateAccount
(
s
.
T
(),
client
,
&
service
.
Account
{
Name
:
"active-rate-limited"
,
Status
:
service
.
StatusActive
})
err
:=
client
.
Account
.
UpdateOneID
(
rateLimited
.
ID
)
.
SetRateLimitResetAt
(
time
.
Now
()
.
Add
(
10
*
time
.
Minute
))
.
Exec
(
context
.
Background
())
s
.
Require
()
.
NoError
(
err
)
},
status
:
service
.
StatusActive
,
wantCount
:
1
,
validate
:
func
(
accounts
[]
service
.
Account
)
{
s
.
Require
()
.
Equal
(
"active-normal"
,
accounts
[
0
]
.
Name
)
},
},
{
name
:
"filter_by_search"
,
setup
:
func
(
client
*
dbent
.
Client
)
{
...
...
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