后端 GetUserLogs 返回前清空 chat_id/upstream_id(omitempty 不输出), 前端搜索框和展开行详情加 isAdminUser 守卫。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>master
| @@ -51,6 +51,10 @@ func GetUserLogs(c *gin.Context) { | |||||
| common.ApiError(c, err) | common.ApiError(c, err) | ||||
| return | return | ||||
| } | } | ||||
| for i := range logs { | |||||
| logs[i].ChatId = "" | |||||
| logs[i].UpstreamId = "" | |||||
| } | |||||
| pageInfo.SetTotal(int(total)) | pageInfo.SetTotal(int(total)) | ||||
| pageInfo.SetItems(logs) | pageInfo.SetItems(logs) | ||||
| common.ApiSuccess(c, pageInfo) | common.ApiSuccess(c, pageInfo) | ||||
| @@ -102,26 +102,26 @@ const LogsFilters = ({ | |||||
| size='small' | size='small' | ||||
| /> | /> | ||||
| <Form.Input | |||||
| field='chat_id' | |||||
| prefix={<IconSearch />} | |||||
| placeholder={t('Chat ID')} | |||||
| showClear | |||||
| pure | |||||
| size='small' | |||||
| /> | |||||
| <Form.Input | |||||
| field='upstream_id' | |||||
| prefix={<IconSearch />} | |||||
| placeholder={t('Upstream ID')} | |||||
| showClear | |||||
| pure | |||||
| size='small' | |||||
| /> | |||||
| {isAdminUser && ( | {isAdminUser && ( | ||||
| <> | <> | ||||
| <Form.Input | |||||
| field='chat_id' | |||||
| prefix={<IconSearch />} | |||||
| placeholder={t('Chat ID')} | |||||
| showClear | |||||
| pure | |||||
| size='small' | |||||
| /> | |||||
| <Form.Input | |||||
| field='upstream_id' | |||||
| prefix={<IconSearch />} | |||||
| placeholder={t('Upstream ID')} | |||||
| showClear | |||||
| pure | |||||
| size='small' | |||||
| /> | |||||
| <Form.Input | <Form.Input | ||||
| field='channel' | field='channel' | ||||
| prefix={<IconSearch />} | prefix={<IconSearch />} | ||||
| @@ -369,13 +369,13 @@ export const useLogsData = () => { | |||||
| value: logs[i].request_id, | value: logs[i].request_id, | ||||
| }); | }); | ||||
| } | } | ||||
| if (logs[i].chat_id) { | |||||
| if (isAdminUser && logs[i].chat_id) { | |||||
| expandDataLocal.push({ | expandDataLocal.push({ | ||||
| key: t('Chat ID'), | key: t('Chat ID'), | ||||
| value: logs[i].chat_id, | value: logs[i].chat_id, | ||||
| }); | }); | ||||
| } | } | ||||
| if (logs[i].upstream_id) { | |||||
| if (isAdminUser && logs[i].upstream_id) { | |||||
| expandDataLocal.push({ | expandDataLocal.push({ | ||||
| key: t('Upstream ID'), | key: t('Upstream ID'), | ||||
| value: logs[i].upstream_id, | value: logs[i].upstream_id, | ||||