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
Commit
b564194f
authored
Feb 04, 2026
by
Calcium-Ion
Committed by
GitHub
Feb 04, 2026
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2635 from feitianbubu/pr/1a2a0dbd92384bfe886b93606003f6753fcb4e9d
feat: task log show username
parents
87ce4b45
68c9890b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletions
+49
-1
model/task.go
+7
-0
web/src/components/table/task-logs/TaskLogsColumnDefs.jsx
+35
-0
web/src/hooks/task-logs/useTaskLogsData.js
+7
-1
No files found.
model/task.go
View file @
b564194f
...
@@ -57,6 +57,7 @@ type Task struct {
...
@@ -57,6 +57,7 @@ type Task struct {
FinishTime
int64
`json:"finish_time" gorm:"index"`
FinishTime
int64
`json:"finish_time" gorm:"index"`
Progress
string
`json:"progress" gorm:"type:varchar(20);index"`
Progress
string
`json:"progress" gorm:"type:varchar(20);index"`
Properties
Properties
`json:"properties" gorm:"type:json"`
Properties
Properties
`json:"properties" gorm:"type:json"`
Username
string
`json:"username,omitempty" gorm:"-"`
// 禁止返回给用户,内部可能包含key等隐私信息
// 禁止返回给用户,内部可能包含key等隐私信息
PrivateData
TaskPrivateData
`json:"-" gorm:"column:private_data;type:json"`
PrivateData
TaskPrivateData
`json:"-" gorm:"column:private_data;type:json"`
Data
json
.
RawMessage
`json:"data" gorm:"type:json"`
Data
json
.
RawMessage
`json:"data" gorm:"type:json"`
...
@@ -233,6 +234,12 @@ func TaskGetAllTasks(startIdx int, num int, queryParams SyncTaskQueryParams) []*
...
@@ -233,6 +234,12 @@ func TaskGetAllTasks(startIdx int, num int, queryParams SyncTaskQueryParams) []*
return
nil
return
nil
}
}
for
_
,
task
:=
range
tasks
{
if
cache
,
err
:=
GetUserCache
(
task
.
UserId
);
err
==
nil
{
task
.
Username
=
cache
.
Username
}
}
return
tasks
return
tasks
}
}
...
...
web/src/components/table/task-logs/TaskLogsColumnDefs.jsx
View file @
b564194f
...
@@ -42,6 +42,8 @@ import {
...
@@ -42,6 +42,8 @@ import {
TASK_ACTION_REMIX_GENERATE
,
TASK_ACTION_REMIX_GENERATE
,
}
from
'../../../constants/common.constant'
;
}
from
'../../../constants/common.constant'
;
import
{
CHANNEL_OPTIONS
}
from
'../../../constants/channel.constants'
;
import
{
CHANNEL_OPTIONS
}
from
'../../../constants/channel.constants'
;
import
{
stringToColor
}
from
'../../../helpers/render'
;
import
{
Avatar
,
Space
}
from
'@douyinfe/semi-ui'
;
const
colors
=
[
const
colors
=
[
'amber'
,
'amber'
,
...
@@ -289,6 +291,39 @@ export const getTaskLogsColumns = ({
...
@@ -289,6 +291,39 @@ export const getTaskLogsColumns = ({
},
},
},
},
{
{
key
:
COLUMN_KEYS
.
USERNAME
,
title
:
t
(
'用户'
),
dataIndex
:
'username'
,
render
:
(
text
,
record
,
index
)
=>
{
if
(
!
isAdminUser
)
{
return
<></>;
}
const
displayName
=
record
.
display_name
;
const
label
=
displayName
||
text
||
t
(
'未知'
);
const
avatarText
=
typeof
displayName
===
'string'
&&
displayName
.
length
>
0
?
displayName
[
0
]
:
typeof
text
===
'string'
&&
text
.
length
>
0
?
text
[
0
]
:
'?'
;
return
(
<
Space
>
<
Avatar
size=
'extra-small'
color=
{
stringToColor
(
label
)
}
style=
{
{
cursor
:
'default'
}
}
>
{
avatarText
}
</
Avatar
>
<
Typography
.
Text
ellipsis=
{
{
showTooltip
:
true
}
}
>
{
label
}
</
Typography
.
Text
>
</
Space
>
);
},
},
{
key
:
COLUMN_KEYS
.
PLATFORM
,
key
:
COLUMN_KEYS
.
PLATFORM
,
title
:
t
(
'平台'
),
title
:
t
(
'平台'
),
dataIndex
:
'platform'
,
dataIndex
:
'platform'
,
...
...
web/src/hooks/task-logs/useTaskLogsData.js
View file @
b564194f
...
@@ -40,6 +40,7 @@ export const useTaskLogsData = () => {
...
@@ -40,6 +40,7 @@ export const useTaskLogsData = () => {
FINISH_TIME
:
'finish_time'
,
FINISH_TIME
:
'finish_time'
,
DURATION
:
'duration'
,
DURATION
:
'duration'
,
CHANNEL
:
'channel'
,
CHANNEL
:
'channel'
,
USERNAME
:
'username'
,
PLATFORM
:
'platform'
,
PLATFORM
:
'platform'
,
TYPE
:
'type'
,
TYPE
:
'type'
,
TASK_ID
:
'task_id'
,
TASK_ID
:
'task_id'
,
...
@@ -104,6 +105,7 @@ export const useTaskLogsData = () => {
...
@@ -104,6 +105,7 @@ export const useTaskLogsData = () => {
// For non-admin users, force-hide admin-only columns (does not touch admin settings)
// For non-admin users, force-hide admin-only columns (does not touch admin settings)
if
(
!
isAdminUser
)
{
if
(
!
isAdminUser
)
{
merged
[
COLUMN_KEYS
.
CHANNEL
]
=
false
;
merged
[
COLUMN_KEYS
.
CHANNEL
]
=
false
;
merged
[
COLUMN_KEYS
.
USERNAME
]
=
false
;
}
}
setVisibleColumns
(
merged
);
setVisibleColumns
(
merged
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -122,6 +124,7 @@ export const useTaskLogsData = () => {
...
@@ -122,6 +124,7 @@ export const useTaskLogsData = () => {
[
COLUMN_KEYS
.
FINISH_TIME
]:
true
,
[
COLUMN_KEYS
.
FINISH_TIME
]:
true
,
[
COLUMN_KEYS
.
DURATION
]:
true
,
[
COLUMN_KEYS
.
DURATION
]:
true
,
[
COLUMN_KEYS
.
CHANNEL
]:
isAdminUser
,
[
COLUMN_KEYS
.
CHANNEL
]:
isAdminUser
,
[
COLUMN_KEYS
.
USERNAME
]:
isAdminUser
,
[
COLUMN_KEYS
.
PLATFORM
]:
true
,
[
COLUMN_KEYS
.
PLATFORM
]:
true
,
[
COLUMN_KEYS
.
TYPE
]:
true
,
[
COLUMN_KEYS
.
TYPE
]:
true
,
[
COLUMN_KEYS
.
TASK_ID
]:
true
,
[
COLUMN_KEYS
.
TASK_ID
]:
true
,
...
@@ -151,7 +154,10 @@ export const useTaskLogsData = () => {
...
@@ -151,7 +154,10 @@ export const useTaskLogsData = () => {
const
updatedColumns
=
{};
const
updatedColumns
=
{};
allKeys
.
forEach
((
key
)
=>
{
allKeys
.
forEach
((
key
)
=>
{
if
(
key
===
COLUMN_KEYS
.
CHANNEL
&&
!
isAdminUser
)
{
if
(
(
key
===
COLUMN_KEYS
.
CHANNEL
||
key
===
COLUMN_KEYS
.
USERNAME
)
&&
!
isAdminUser
)
{
updatedColumns
[
key
]
=
false
;
updatedColumns
[
key
]
=
false
;
}
else
{
}
else
{
updatedColumns
[
key
]
=
checked
;
updatedColumns
[
key
]
=
checked
;
...
...
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