Compare commits

..

2 Commits

Author SHA1 Message Date
guke 92cdc64654 Merge branch 'main' into codex/comparison-device-display 2026-07-27 16:38:27 +08:00
linkeyu 4cd9c19e4d 优化:展示比价记录机型与 ROM 版本
列表和详情优先展示可读机型名,保留原始设备编码,并补充 ROM 版本。
2026-07-27 14:36:56 +08:00
6 changed files with 19 additions and 39 deletions
+10 -10
View File
@@ -30,7 +30,7 @@ import {
} from '@ant-design/icons';
import dayjs, { type Dayjs } from 'dayjs';
import { api, errMsg } from '@/lib/api';
import { formatUtcTime, nearestRankPercentile } from '@/lib/format';
import { formatUtcTime, percentile } from '@/lib/format';
import type {
AdRevenueDaily,
AdRevenueHourly,
@@ -758,9 +758,9 @@ export default function AdRevenueReportPage() {
.filter((item) => item.feed_scene === sceneName)
.map((item) => item.sub_count ?? 1);
return {
p5: nearestRankPercentile(counts, 0.05),
p50: nearestRankPercentile(counts, 0.5),
p95: nearestRankPercentile(counts, 0.95),
p5: percentile(counts, 0.05, false),
p50: percentile(counts, 0.5, false),
p95: percentile(counts, 0.95, false),
};
};
return { coupon: summarize('coupon'), comparison: summarize('comparison') };
@@ -1083,12 +1083,12 @@ export default function AdRevenueReportPage() {
</Typography.Text>
</Divider>
<Row gutter={[16, 12]}>
<Col span={4}><Statistic title="单次领券广告数 P5" value={sessionAdCounts.coupon.p5 ?? '-'} precision={0} /></Col>
<Col span={4}><Statistic title="单次领券广告数 P50" value={sessionAdCounts.coupon.p50 ?? '-'} precision={0} /></Col>
<Col span={4}><Statistic title="单次领券广告数 P95" value={sessionAdCounts.coupon.p95 ?? '-'} precision={0} /></Col>
<Col span={4}><Statistic title="单次比价广告数 P5" value={sessionAdCounts.comparison.p5 ?? '-'} precision={0} /></Col>
<Col span={4}><Statistic title="单次比价广告数 P50" value={sessionAdCounts.comparison.p50 ?? '-'} precision={0} /></Col>
<Col span={4}><Statistic title="单次比价广告数 P95" value={sessionAdCounts.comparison.p95 ?? '-'} precision={0} /></Col>
<Col span={4}><Statistic title="单次领券广告数 P5" value={sessionAdCounts.coupon.p5 ?? '-'} precision={1} /></Col>
<Col span={4}><Statistic title="单次领券广告数 P50" value={sessionAdCounts.coupon.p50 ?? '-'} precision={1} /></Col>
<Col span={4}><Statistic title="单次领券广告数 P95" value={sessionAdCounts.coupon.p95 ?? '-'} precision={1} /></Col>
<Col span={4}><Statistic title="单次比价广告数 P5" value={sessionAdCounts.comparison.p5 ?? '-'} precision={1} /></Col>
<Col span={4}><Statistic title="单次比价广告数 P50" value={sessionAdCounts.comparison.p50 ?? '-'} precision={1} /></Col>
<Col span={4}><Statistic title="单次比价广告数 P95" value={sessionAdCounts.comparison.p95 ?? '-'} precision={1} /></Col>
</Row>
</Card>
)}
@@ -333,14 +333,6 @@ export default function ComparisonRecordsPage() {
<b style={{ color: r.saved_amount_cents > 0 ? '#3f8600' : '#999' }}>{yuan(r.saved_amount_cents)}</b>
),
},
{
title: '是否下单',
dataIndex: 'ordered',
width: 84,
render: (ordered: boolean) => (
<Tag color={ordered ? 'green' : 'default'}>{ordered ? '已下单' : '未下单'}</Tag>
),
},
{ title: 'LLM', dataIndex: 'llm_call_count', width: 56, render: (v) => v ?? '-' },
{
title: 'TOKEN',
+2 -2
View File
@@ -710,7 +710,7 @@ export default function DashboardPage() {
<div>
<h1></h1>
<p>
{updatedAt ?? '--'} · · 00:00
{updatedAt ?? '--'} · · 00:00
</p>
</div>
<div className="controls">
@@ -734,7 +734,7 @@ export default function DashboardPage() {
format="YYYY-MM-DD"
allowClear={false}
open={datePickerOpen}
disabledDate={(date) => date.isAfter(dayjs(), 'day')}
disabledDate={(date) => date.isAfter(dayjs().subtract(1, 'day'), 'day')}
suffixIcon={<CalendarOutlined />}
onClick={() => setDatePickerOpen(true)}
onOpenChange={setDatePickerOpen}
@@ -570,7 +570,6 @@ export function WithdrawReviewPage({ mode = 'other' }: { mode?: WithdrawReviewMo
},
{
title: '失败/拒绝原因',
key: 'fail_reason',
dataIndex: 'fail_reason',
ellipsis: true,
render: (v: string | null) => v || <Text type="secondary">-</Text>,
@@ -648,10 +647,6 @@ export function WithdrawReviewPage({ mode = 'other' }: { mode?: WithdrawReviewMo
},
},
];
const visibleColumns =
activeStatus === 'pending' || activeStatus === 'success'
? columns.filter((column) => column.key !== 'fail_reason')
: columns;
const inviteeColumns: ColumnsType<InviteeDetail> = [
{ title: '手机号', dataIndex: 'phone', width: 130 },
@@ -950,7 +945,7 @@ export function WithdrawReviewPage({ mode = 'other' }: { mode?: WithdrawReviewMo
}
: undefined
}
columns={visibleColumns}
columns={columns}
dataSource={items}
loading={loading}
pagination={{
@@ -994,6 +989,12 @@ export function WithdrawReviewPage({ mode = 'other' }: { mode?: WithdrawReviewMo
<Descriptions.Item label="金额">
<Text strong>{yuan(detail.order.amount_cents)}</Text>
</Descriptions.Item>
<Descriptions.Item label="提现类型">
{detail.order.source === 'invite_cash' ? '邀请奖励提现' : '福利页提现'}
</Descriptions.Item>
<Descriptions.Item label="累计成功提现">
{yuan(detail.cumulative_success_cents)}
</Descriptions.Item>
<Descriptions.Item label="提交时间">
{dt(detail.order.created_at)}
</Descriptions.Item>
-12
View File
@@ -37,18 +37,6 @@ export function percentile(values: readonly number[], q: number, round = true):
return round ? Math.round(result) : result;
}
/**
* 离散计数分位数(nearest-rank)。
* 广告条数等不可拆分的计数不做线性插值,结果始终取自真实样本。
*/
export function nearestRankPercentile(values: readonly number[], q: number): number | null {
if (!values.length) return null;
const sorted = [...values].sort((a, b) => a - b);
const quantile = Math.min(1, Math.max(0, q));
const rank = Math.max(1, Math.ceil(quantile * sorted.length));
return sorted[rank - 1];
}
const hasTz = (v: string) => /(?:Z|[+-]\d{2}:?\d{2})$/i.test(v);
/** 把 UTC 口径字符串解析为带时区的 dayjs(无时区后缀的补 Z 当 UTC)。 */
-1
View File
@@ -457,7 +457,6 @@ export interface ComparisonRecordListItem {
source_price_cents: number | null;
best_price_cents: number | null;
saved_amount_cents: number | null;
ordered: boolean;
total_ms: number | null;
step_count: number | null;
llm_call_count: number | null;