diff --git a/server/pagination.mjs b/server/pagination.mjs index f867299..c6b68f2 100644 --- a/server/pagination.mjs +++ b/server/pagination.mjs @@ -200,7 +200,7 @@ export async function listLedgerPaged(pool, query) { params, ); const [rows] = await pool.query( - `SELECT l.id, l.user_id, u.username, l.type, l.amount_cents, l.tokens, + `SELECT l.id, l.user_id, u.username, u.display_name, l.type, l.amount_cents, l.tokens, l.session_id, l.note, l.created_at FROM h5_billing_ledger l JOIN h5_users u ON u.id = l.user_id @@ -214,6 +214,7 @@ export async function listLedgerPaged(pool, query) { id: Number(row.id), userId: row.user_id, username: row.username, + displayName: row.display_name, type: row.type, amountCents: Number(row.amount_cents), tokens: Number(row.tokens), diff --git a/src/admin/pages/BillingPage.tsx b/src/admin/pages/BillingPage.tsx index 41797af..f97ccbd 100644 --- a/src/admin/pages/BillingPage.tsx +++ b/src/admin/pages/BillingPage.tsx @@ -839,7 +839,10 @@ function LedgerTab() { {result.items.map((row) => ( {formatTime(row.createdAt)} - @{row.username} + + {row.displayName || row.username} + @{row.username} + {TYPE_LABEL[row.type] ?? row.type} {row.amountCents >= 0 ? '+' : ''}¥{formatYuan(Math.abs(row.amountCents))} diff --git a/src/types.ts b/src/types.ts index 7752159..86275f8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -282,6 +282,7 @@ export type LedgerEntry = { id: number; userId: string; username: string; + displayName: string; type: 'recharge' | 'deduct' | 'refund' | 'adjust'; amountCents: number; tokens: number;