feat(log): 日志列表加「域名来源」列, 仅管理员可见

- common-logs-columns 的 isAdmin 块内新增 domain_source 列, 取 other.admin_info.domain_host
- 普通用户该列不存在(列定义在 isAdmin 分支), 与详情弹窗的角色控制一致
This commit is contained in:
2026-06-03 05:15:54 +08:00
parent d481e1ae62
commit 44cadcb264
2 changed files with 24 additions and 0 deletions

View File

@@ -463,6 +463,28 @@ export function useCommonLogsColumns(isAdmin: boolean): ColumnDef<UsageLog>[] {
meta: { label: t('User') }, meta: { label: t('User') },
} }
) )
columns.push({
id: 'domain_source',
accessorFn: (row) => row.channel,
header: ({ column }) => (
<DataTableColumnHeader column={column} title={t('Domain source')} />
),
cell: function DomainSourceCell({ row }) {
const log = row.original
if (!isDisplayableLogType(log.type)) return null
const other = parseLogOther(log.other)
const domainHost = other?.admin_info?.domain_host
if (!domainHost) {
return <span className='text-muted-foreground/50 text-xs'></span>
}
return (
<span className='text-muted-foreground font-mono text-xs'>
{domainHost}
</span>
)
},
meta: { label: t('Domain source') },
})
} }
columns.push({ columns.push({

View File

@@ -99,6 +99,8 @@ export interface LogOtherData {
use_channel?: number[] use_channel?: number[]
local_count_tokens?: boolean local_count_tokens?: boolean
channel_affinity?: ChannelAffinityInfo channel_affinity?: ChannelAffinityInfo
// Domain routing source (admin only) — 命中域名路由时的来源域名
domain_host?: string
// Top-up audit fields (type=1, admin only) // Top-up audit fields (type=1, admin only)
payment_method?: string payment_method?: string
callback_payment_method?: string callback_payment_method?: string