fix: 修复排名页跳转用户详情数据为0的问题

排名页使用 display_name(中文名)作为链接参数,但详情查询用
username(英文)过滤,导致 SQL 匹配不到数据全部返回0。

- 排名 API 额外返回 username 字段
- 跳转链接改用 username 作为参数
- 详情 API 返回 display_name 用于页面标题展示
This commit is contained in:
2026-04-08 20:08:08 +08:00
parent 13805a47be
commit c809ab16e6
3 changed files with 14 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ import { useI18n } from "@/lib/i18n";
interface DetailData {
calls: number; prompt_tokens: number; completion_tokens: number;
total_tokens: number; quota: number;
total_tokens: number; quota: number; display_name?: string;
models?: { name: string; calls: number; total_tokens: number; quota: number }[];
users?: { name: string; calls: number; total_tokens: number; quota: number }[];
channel_name?: string;
@@ -50,7 +50,7 @@ export default function DetailPage() {
useEffect(() => { fetchData(); }, [fetchData]);
const title = type === "channel" ? (data?.channel_name || decodedId) : decodedId;
const title = type === "channel" ? (data?.channel_name || decodedId) : (data?.display_name || decodedId);
const typeLabel = { user: t("detail.user"), model: t("detail.model"), channel: t("detail.channel") }[type] || type;
const breakdownItems = data?.models || data?.users || [];
const breakdownLabel = data?.models ? t("detail.modelDist") : t("detail.userDist");