Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
bf130c5c
authored
Apr 15, 2026
by
Calcium-Ion
Committed by
GitHub
Apr 15, 2026
Browse files
Options
Browse Files
Download
Plain Diff
feat: include admin username in quota adjustment logs (#4216)
parents
f7adf02e
d15e14b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
controller/user.go
+4
-3
No files found.
controller/user.go
View file @
bf130c5c
...
...
@@ -912,6 +912,7 @@ func ManageUser(c *gin.Context) {
}
user
.
Role
=
common
.
RoleCommonUser
case
"add_quota"
:
adminName
:=
c
.
GetString
(
"username"
)
switch
req
.
Mode
{
case
"add"
:
if
req
.
Value
<=
0
{
...
...
@@ -923,7 +924,7 @@ func ManageUser(c *gin.Context) {
return
}
model
.
RecordLog
(
user
.
Id
,
model
.
LogTypeManage
,
fmt
.
Sprintf
(
"管理员
增加用户额度 %s"
,
logger
.
LogQuota
(
req
.
Value
)))
fmt
.
Sprintf
(
"管理员
(%s)增加用户额度 %s"
,
adminName
,
logger
.
LogQuota
(
req
.
Value
)))
case
"subtract"
:
if
req
.
Value
<=
0
{
common
.
ApiErrorI18n
(
c
,
i18n
.
MsgUserQuotaChangeZero
)
...
...
@@ -934,7 +935,7 @@ func ManageUser(c *gin.Context) {
return
}
model
.
RecordLog
(
user
.
Id
,
model
.
LogTypeManage
,
fmt
.
Sprintf
(
"管理员
减少用户额度 %s"
,
logger
.
LogQuota
(
req
.
Value
)))
fmt
.
Sprintf
(
"管理员
(%s)减少用户额度 %s"
,
adminName
,
logger
.
LogQuota
(
req
.
Value
)))
case
"override"
:
oldQuota
:=
user
.
Quota
if
err
:=
model
.
DB
.
Model
(
&
model
.
User
{})
.
Where
(
"id = ?"
,
user
.
Id
)
.
Update
(
"quota"
,
req
.
Value
)
.
Error
;
err
!=
nil
{
...
...
@@ -942,7 +943,7 @@ func ManageUser(c *gin.Context) {
return
}
model
.
RecordLog
(
user
.
Id
,
model
.
LogTypeManage
,
fmt
.
Sprintf
(
"管理员
覆盖用户额度从 %s 为 %s"
,
logger
.
LogQuota
(
oldQuota
),
logger
.
LogQuota
(
req
.
Value
)))
fmt
.
Sprintf
(
"管理员
(%s)覆盖用户额度从 %s 为 %s"
,
adminName
,
logger
.
LogQuota
(
oldQuota
),
logger
.
LogQuota
(
req
.
Value
)))
default
:
common
.
ApiErrorI18n
(
c
,
i18n
.
MsgInvalidParams
)
return
...
...
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