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
a42a1f08
Commit
a42a1f08
authored
Mar 07, 2026
by
shaw
Browse files
fix: 编辑error状态账号时保存报Status验证失败
后端UpdateAccountRequest.Status的oneof验证缺少error状态, 前端编辑表单也未处理error状态,导致编辑异常账号时无法保存
parent
ebd5253e
Changes
3
Hide whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/account_handler.go
View file @
a42a1f08
...
@@ -122,7 +122,7 @@ type UpdateAccountRequest struct {
...
@@ -122,7 +122,7 @@ type UpdateAccountRequest struct {
Priority
*
int
`json:"priority"`
Priority
*
int
`json:"priority"`
RateMultiplier
*
float64
`json:"rate_multiplier"`
RateMultiplier
*
float64
`json:"rate_multiplier"`
LoadFactor
*
int
`json:"load_factor"`
LoadFactor
*
int
`json:"load_factor"`
Status
string
`json:"status" binding:"omitempty,oneof=active inactive"`
Status
string
`json:"status" binding:"omitempty,oneof=active inactive
error
"`
GroupIDs
*
[]
int64
`json:"group_ids"`
GroupIDs
*
[]
int64
`json:"group_ids"`
ExpiresAt
*
int64
`json:"expires_at"`
ExpiresAt
*
int64
`json:"expires_at"`
AutoPauseOnExpired
*
bool
`json:"auto_pause_on_expired"`
AutoPauseOnExpired
*
bool
`json:"auto_pause_on_expired"`
...
...
frontend/src/components/account/EditAccountModal.vue
View file @
a42a1f08
...
@@ -1617,15 +1617,21 @@ const form = reactive({
...
@@ -1617,15 +1617,21 @@ const form = reactive({
load_factor
:
null
as
number
|
null
,
load_factor
:
null
as
number
|
null
,
priority
:
1
,
priority
:
1
,
rate_multiplier
:
1
,
rate_multiplier
:
1
,
status
:
'
active
'
as
'
active
'
|
'
inactive
'
,
status
:
'
active
'
as
'
active
'
|
'
inactive
'
|
'
error
'
,
group_ids
:
[]
as
number
[],
group_ids
:
[]
as
number
[],
expires_at
:
null
as
number
|
null
expires_at
:
null
as
number
|
null
}
)
}
)
const
statusOptions
=
computed
(()
=>
[
const
statusOptions
=
computed
(()
=>
{
{
value
:
'
active
'
,
label
:
t
(
'
common.active
'
)
}
,
const
options
=
[
{
value
:
'
inactive
'
,
label
:
t
(
'
common.inactive
'
)
}
{
value
:
'
active
'
,
label
:
t
(
'
common.active
'
)
}
,
])
{
value
:
'
inactive
'
,
label
:
t
(
'
common.inactive
'
)
}
]
if
(
form
.
status
===
'
error
'
)
{
options
.
push
({
value
:
'
error
'
,
label
:
t
(
'
admin.accounts.status.error
'
)
}
)
}
return
options
}
)
const
expiresAtInput
=
computed
({
const
expiresAtInput
=
computed
({
get
:
()
=>
formatDateTimeLocal
(
form
.
expires_at
),
get
:
()
=>
formatDateTimeLocal
(
form
.
expires_at
),
...
@@ -1651,7 +1657,7 @@ watch(
...
@@ -1651,7 +1657,7 @@ watch(
form
.
load_factor
=
newAccount
.
load_factor
??
null
form
.
load_factor
=
newAccount
.
load_factor
??
null
form
.
priority
=
newAccount
.
priority
form
.
priority
=
newAccount
.
priority
form
.
rate_multiplier
=
newAccount
.
rate_multiplier
??
1
form
.
rate_multiplier
=
newAccount
.
rate_multiplier
??
1
form
.
status
=
(
newAccount
.
status
===
'
active
'
||
newAccount
.
status
===
'
inactive
'
)
form
.
status
=
(
newAccount
.
status
===
'
active
'
||
newAccount
.
status
===
'
inactive
'
||
newAccount
.
status
===
'
error
'
)
?
newAccount
.
status
?
newAccount
.
status
:
'
active
'
:
'
active
'
form
.
group_ids
=
newAccount
.
group_ids
||
[]
form
.
group_ids
=
newAccount
.
group_ids
||
[]
...
@@ -2225,7 +2231,7 @@ const handleSubmit = async () => {
...
@@ -2225,7 +2231,7 @@ const handleSubmit = async () => {
if
(
!
props
.
account
)
return
if
(
!
props
.
account
)
return
const
accountID
=
props
.
account
.
id
const
accountID
=
props
.
account
.
id
if
(
form
.
status
!==
'
active
'
&&
form
.
status
!==
'
inactive
'
)
{
if
(
form
.
status
!==
'
active
'
&&
form
.
status
!==
'
inactive
'
&&
form
.
status
!==
'
error
'
)
{
appStore
.
showError
(
t
(
'
admin.accounts.pleaseSelectStatus
'
))
appStore
.
showError
(
t
(
'
admin.accounts.pleaseSelectStatus
'
))
return
return
}
}
...
...
frontend/src/types/index.ts
View file @
a42a1f08
...
@@ -809,7 +809,7 @@ export interface UpdateAccountRequest {
...
@@ -809,7 +809,7 @@ export interface UpdateAccountRequest {
priority
?:
number
priority
?:
number
rate_multiplier
?:
number
// Account billing multiplier (>=0, 0 means free)
rate_multiplier
?:
number
// Account billing multiplier (>=0, 0 means free)
schedulable
?:
boolean
schedulable
?:
boolean
status
?:
'
active
'
|
'
inactive
'
status
?:
'
active
'
|
'
inactive
'
|
'
error
'
group_ids
?:
number
[]
group_ids
?:
number
[]
expires_at
?:
number
|
null
expires_at
?:
number
|
null
auto_pause_on_expired
?:
boolean
auto_pause_on_expired
?:
boolean
...
...
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