Compare commits

...

11 Commits

Author SHA1 Message Date
linkeyu 1d28358f07 修复:统一提现审核状态汇总与列表口径 2026-07-27 15:44:03 +08:00
linkeyu 89dafd4886 完善邀请提现、其他提现与用户管理页面 (#75)
## 改动内容
- 新增邀请提现审核页,并与其他提现共用审核组件
- 完善筛选、状态统计、详情、邀请用户信息、风险提示和时间线
- 按订单状态展示微信转账单号和真实失败原因
- 支持高风险标记、取消标记和备注维护
- 优化用户管理及提现列表的列宽、固定操作列和横向滚动
- 移除提现实名、账本校验和人工处理超时订单入口

## 验证
- npm run build:通过
- npx tsc --noEmit:通过

## 说明
- 本地设计记录与 mock 数据未提交

---------

Co-authored-by: guke <guke@wonderable.ai>
Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #75
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 14:57:48 +08:00
linkeyu f63378ebd4 修复纯展示广告明细类型字段缺失 (#86)
## 问题

impressionOnlyDetail 返回 AdRevenueDetailRow 时缺少 AdRevenueRecord 的必填字段 adn 和 slot_id,导致 next build 在类型检查阶段失败。

## 修复

- 从 AdRevenueRow 透传 adn
- 从 AdRevenueRow 透传 slot_id
- 保留 source_adn 的现有展示口径

## 验证

- npm run build 通过
- TypeScript 类型检查通过
- 生产静态页面生成通过

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #86
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 14:18:40 +08:00
linkeyu 10b82ad564 优化用户反馈设备信息展示 (#85)
## 改动说明
- 反馈列表优先展示可读手机型号
- 同时展示原始硬件编码与厂商信息
- 厂商系统版本和 Android 版本分层展示

## 验证
- Next.js 生产构建通过

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #85
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 13:33:53 +08:00
linkeyu f76440cdbf 优化:将空计算因子显示为可读状态 (#82)
## 本次改动

- 因子1、因子2、LT累计条数为空时显示对应的可读发奖状态
- 支持“观看时长不足”“提前关闭”“次数超限”“eCPM 缺失”“仅展示”等状态
- 已发奖但计算字段异常缺失时显示“计算数据缺失”
- 将纯展示事件统一为逐条明细表,避免空值被误认为数据丢失

## 说明

只改变后台展示,不改变金币公式、实发结果或 LT 累计规则。

## 验证

TypeScript `--noEmit` 检查通过。

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #82
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 11:51:18 +08:00
linkeyu 5373e3735c 优化比价记录用户信息显示颜色 (#83)
## 改动说明
- 比价记录列表中的手机号和用户名改为蓝色文本
- 保留原有整行点击行为,继续打开比价记录侧边栏
- 不新增用户详情页跳转

## 验证
- TypeScript 类型检查通过
- 本地确认用户信息为蓝色且不包含详情页链接

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #83
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 11:36:50 +08:00
linkeyu 590f59dee9 修复:看视频统计包含提现视频 (#79)
## 本次改动

- “看视频收益”合并福利视频与提现视频收益
- “看视频条数”合并两类视频展示记录
- “看视频 eCPM”按合并后的总收益和总展示数计算

## 范围

仅修改 `src/app/(main)/ad-revenue-report/page.tsx`;服务端已分别提供两类 `type_stats`,无需改动。

---------

Co-authored-by: guke <guke@wonderable.ai>
Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #79
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 11:36:36 +08:00
linkeyu dd28307413 优化:修复侧栏滚动与权限管理位置 (#77)
## 本次改动

- 修复小屏时左侧导航无法滚动、末尾菜单不可见的问题
- 将“权限管理”调整至“监控审计”板块之前

## 范围

仅修改 `src/app/(main)/layout.tsx`。

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #77
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 11:36:20 +08:00
linkeyu c055cd705d 优化:完善广告收益顶部筛选默认值 (#78)
## 本次改动

- 类型和场景筛选增加明确的“全部”选项
- 将默认每页记录数从 1000 调整为 50

## 范围

仅修改 `src/app/(main)/ad-revenue-report/page.tsx`。

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #78
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 11:36:10 +08:00
linkeyu 8d7f36ddac 修复:展示收益明细广告网络来源 (#81)
## 本次改动

- 展开聚合收益记录时优先展示每条明细自身的 ADN
- 单条发奖明细同样读取明细级来源
- 无唯一来源证据的历史记录明确显示“未上报”

## 验证

TypeScript `--noEmit` 检查通过。

依赖服务端 PR:WonderableAI/shaguabijia-app-server#179。

---------

Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #81
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-27 10:24:12 +08:00
linkeyu 694944cb5e 优化:移除提现类型字段 (#73)
## 修改内容
- 删除提现审核 6 个状态子页面共用的提现类型筛选项
- 删除列表和详情抽屉中的提现类型字段
- 筛选栏仅保留:用户手机号、开始时间-结束时间、倒序、重置
- 日期与排序字段固定为申请时间,并同步清理无用前端状态和请求参数
- 同步收窄表格横向滚动宽度

## 后端评估
- 无需后端改动
- source 仍是提现账本分流、扣款、退款与对账所需的业务字段,保留 API 兼容性

## 本地验证
- npx tsc --noEmit
- npm run build
- git diff --check

---------

Co-authored-by: guke <guke@wonderable.ai>
Co-authored-by: linkeyu <798648091@qq.com>
Reviewed-on: #73
Co-authored-by: linkeyu <linkeyu@wonderable.ai>
Co-committed-by: linkeyu <linkeyu@wonderable.ai>
2026-07-25 18:29:50 +08:00
14 changed files with 1711 additions and 1201 deletions
@@ -15,6 +15,8 @@ interface UserOverviewResp {
id: number;
phone: string;
nickname: string | null;
is_high_risk: boolean;
high_risk_note: string | null;
status: string;
wechat_nickname: string | null;
created_at: string;
@@ -49,6 +51,8 @@ export default function UserAdRevenueDrawer({ open, onClose, userId, phone }: Pr
id: o.user.id,
phone: o.user.phone,
nickname: o.user.nickname,
is_high_risk: o.user.is_high_risk,
high_risk_note: o.user.high_risk_note,
status: o.user.status,
wechat_nickname: o.user.wechat_nickname, // 概览接口已返回微信昵称
wechat_avatar_url: null,
+122 -41
View File
@@ -9,7 +9,6 @@ import {
Card,
Col,
DatePicker,
Descriptions,
Divider,
InputNumber,
Modal,
@@ -43,6 +42,8 @@ import type {
import UserAdRevenueDrawer from './UserAdRevenueDrawer';
const { RangePicker } = DatePicker;
const DEFAULT_PAGE_SIZE = 50;
const ALL_FILTER_VALUE = '__all__';
// 广告类型标签
const TYPE_TAG: Record<string, { color: string; label: string }> = {
@@ -190,11 +191,76 @@ const LT_FACTOR_ROWS = [
{ key: '5', lt: '第 11 条及以后', factor: 1.0 },
];
type AdRevenueDetailRow = AdRevenueRecord & { source_adn?: string | null };
type AdRevenueDetailRow = AdRevenueRecord & {
source_adn?: string | null;
is_impression_only?: boolean;
};
const FORMULA_EMPTY_STATUS_LABEL: Record<string, string> = {
capped: '次数超限',
ecpm_missing: 'eCPM 缺失',
too_short: '观看时长不足',
closed_early: '提前关闭',
impression_only: '仅展示',
};
// 未发奖记录用可读状态代替空值,避免误认为数据丢失;悬停时说明为何没有计算因子。
function renderFormulaValue(value: string | number, row: AdRevenueDetailRow) {
if (value !== '-') return value;
const isGrantedButMissing = row.status === 'granted';
const reason = isGrantedButMissing
? '该记录标记为已发奖,但计算因子缺失,需要进一步排查'
: row.is_impression_only
? '该记录只有广告展示,没有对应发奖记录'
: REWARD_STATUS_HINT[row.status] ?? `发奖状态为 ${row.status || '未知'}`;
const statusLabel = isGrantedButMissing
? '计算数据缺失'
: (FORMULA_EMPTY_STATUS_LABEL[row.status] ?? row.status) || '未进入计算';
return (
<Tooltip
title={isGrantedButMissing
? reason
: `${reason};未进入金币计算,不占用 LT 累计条数,因此不展示因子。`}
>
<span>{statusLabel}</span>
</Tooltip>
);
}
function impressionOnlyDetail(row: AdRevenueRow): AdRevenueDetailRow {
return {
record_id: 0,
created_at: row.created_at,
status: 'impression_only',
ecpm: row.ecpm,
ecpm_factor: null,
units: 0,
lt_index_start: null,
lt_index_end: null,
lt_factor_start: null,
lt_factor_end: null,
expected_coin: 0,
actual_coin: 0,
matched: true,
adn: row.adn,
slot_id: row.slot_id,
source_adn: row.adn,
is_impression_only: true,
};
}
// 展开行(逐条事件展开)- 该条的发奖复算明细(还原金币审计的 eCPM/因子1/份数/LT/因子2 等列)
const DETAIL_COLUMNS: ColumnsType<AdRevenueDetailRow> = [
{ title: '来源广告网络', dataIndex: 'source_adn', width: 110, render: (value: string | null) => value || '-' },
{
title: '来源广告网络',
dataIndex: 'source_adn',
width: 110,
render: (value: string | null) => value?.trim() || (
<Tooltip title="该历史记录没有可唯一确认的 SDK 广告来源,未猜测填充。">
<span></span>
</Tooltip>
),
},
{
title: 'eCPM(元)',
dataIndex: 'ecpm',
@@ -208,18 +274,25 @@ const DETAIL_COLUMNS: ColumnsType<AdRevenueDetailRow> = [
render: (v: string | null) => (v == null || Number.isNaN(Number(v)) ? '-' : (Number(v) / 100 / 1000).toFixed(4)),
},
{ title: '实发金币数', dataIndex: 'actual_coin', width: 100 },
{ title: '因子1', dataIndex: 'ecpm_factor', width: 70, render: (v: number | null) => v ?? '-' },
{
title: '因子1',
dataIndex: 'ecpm_factor',
width: 70,
render: (v: number | null, row: AdRevenueDetailRow) => renderFormulaValue(v ?? '-', row),
},
{
title: '因子2',
key: 'lt_factor',
width: 90,
render: (_: unknown, r: AdRevenueDetailRow) => fmtFactorRange(r.lt_factor_start, r.lt_factor_end),
render: (_: unknown, row: AdRevenueDetailRow) =>
renderFormulaValue(fmtFactorRange(row.lt_factor_start, row.lt_factor_end), row),
},
{
title: 'LT累计条数',
key: 'lt_index',
width: 100,
render: (_: unknown, r: AdRevenueDetailRow) => fmtIndexRange(r.lt_index_start, r.lt_index_end),
render: (_: unknown, row: AdRevenueDetailRow) =>
renderFormulaValue(fmtIndexRange(row.lt_index_start, row.lt_index_end), row),
},
];
@@ -387,13 +460,13 @@ export default function AdRevenueReportPage() {
const [scene, setScene] = useState<string | undefined>();
const [granularity, setGranularity] = useState<'day' | 'hour'>('day');
const [sortBy, setSortBy] = useState<'time' | 'ecpm'>('time'); // 明细排序:time=时间倒序 / ecpm=eCPM 倒序
const [limit, setLimit] = useState<number>(1000); // 默认拉满接口单页上限,供单次流程广告数分位统计
const [limit, setLimit] = useState<number>(DEFAULT_PAGE_SIZE);
const [page, setPage] = useState<number>(1); // 当前页码(后端分页;1 起)
const [queriedGranularity, setQueriedGranularity] = useState<'day' | 'hour'>('day'); // 本次结果对应的粒度,决定是否显示「小时」列
const [queriedMultiDay, setQueriedMultiDay] = useState(false); // 本次结果是否跨多天,决定显示「日期」列 + 按天/按小时图
const [data, setData] = useState<AdRevenueReport | null>(null);
const [allFlowItems, setAllFlowItems] = useState<AdRevenueRow[]>([]);
const [queriedLimit, setQueriedLimit] = useState<number>(1000);
const [queriedLimit, setQueriedLimit] = useState<number>(DEFAULT_PAGE_SIZE);
const [loading, setLoading] = useState(false);
const [formulaOpen, setFormulaOpen] = useState(false);
// 点用户手机号弹出的「用户广告收益详情」半屏抽屉(userId + 手机号;null=关闭)
@@ -661,9 +734,17 @@ export default function AdRevenueReportPage() {
: data.date_from
: `${data.date_from} ~ ${data.date_to}`;
// 第二行大盘「分广告类型」:draw / 激励视频 各自 收益 / eCPM / 展示条数;eCPM = 收益÷展示×1000。
// 第二行大盘「分广告类型」:看视频包含福利视频与提现视频;
// eCPM 使用合并后的总收益 ÷ 总展示数 × 1000,避免只读取 reward_video 而漏算提现视频。
const drawStat = data?.type_stats?.draw;
const rvStat = data?.type_stats?.reward_video;
const rewardVideoStat = data?.type_stats?.reward_video;
const withdrawalVideoStat = data?.type_stats?.withdrawal_video;
const videoStat: AdRevenueTypeStat = {
impressions:
(rewardVideoStat?.impressions ?? 0) + (withdrawalVideoStat?.impressions ?? 0),
revenue_yuan:
(rewardVideoStat?.revenue_yuan ?? 0) + (withdrawalVideoStat?.revenue_yuan ?? 0),
};
const ecpmOf = (s?: AdRevenueTypeStat) =>
s && s.impressions > 0 ? (s.revenue_yuan / s.impressions) * 1000 : 0;
@@ -775,12 +856,11 @@ export default function AdRevenueReportPage() {
<Space size={6}>
<Typography.Text type="secondary"></Typography.Text>
<Select
placeholder="全部"
value={adType}
onChange={setAdType}
allowClear
value={adType ?? ALL_FILTER_VALUE}
onChange={(value) => setAdType(value === ALL_FILTER_VALUE ? undefined : value)}
style={{ width: 150 }}
options={[
{ value: ALL_FILTER_VALUE, label: '全部' },
{ value: 'reward_video', label: '看视频' },
{ value: 'draw', label: 'Draw 信息流' },
{ value: 'withdrawal_video', label: '提现看视频' },
@@ -790,12 +870,11 @@ export default function AdRevenueReportPage() {
<Space size={6}>
<Typography.Text type="secondary"></Typography.Text>
<Select
placeholder="全部"
value={scene}
onChange={setScene}
allowClear
value={scene ?? ALL_FILTER_VALUE}
onChange={(value) => setScene(value === ALL_FILTER_VALUE ? undefined : value)}
style={{ width: 130 }}
options={[
{ value: ALL_FILTER_VALUE, label: '全部' },
{ value: 'comparison', label: '比价' },
{ value: 'coupon', label: '领券' },
{ value: 'welfare', label: '福利' },
@@ -987,13 +1066,13 @@ export default function AdRevenueReportPage() {
<Statistic title="Draw 信息流条数" value={drawStat?.impressions ?? 0} />
</Col>
<Col span={4}>
<Statistic title="看视频收益(元)" value={rvStat?.revenue_yuan ?? 0} precision={4} />
<Statistic title="看视频收益(元)" value={videoStat.revenue_yuan} precision={4} />
</Col>
<Col span={4}>
<Statistic title="看视频 eCPM(元/千次)" value={ecpmOf(rvStat)} precision={2} />
<Statistic title="看视频 eCPM(元/千次)" value={ecpmOf(videoStat)} precision={2} />
</Col>
<Col span={4}>
<Statistic title="看视频条数" value={rvStat?.impressions ?? 0} />
<Statistic title="看视频条数" value={videoStat.impressions} />
</Col>
</Row>
<Divider orientation="left" plain style={{ marginTop: 20, marginBottom: 16 }}>
@@ -1102,7 +1181,11 @@ export default function AdRevenueReportPage() {
style={{ marginTop: 8 }}
rowKey="record_id"
columns={DETAIL_COLUMNS}
dataSource={r.sub_rewards.map((detail) => ({ ...detail, source_adn: r.adn }))}
dataSource={r.sub_rewards.map((detail) => ({
...detail,
// 一次比价/领券可能由不同 ADN 连续填充,优先显示本条发奖记录的来源。
source_adn: detail.adn ?? r.adn,
}))}
pagination={false}
size="small"
scroll={{ x: 900 }}
@@ -1118,7 +1201,10 @@ export default function AdRevenueReportPage() {
style={{ marginTop: 8 }}
rowKey="record_id"
columns={DETAIL_COLUMNS}
dataSource={[{ ...r.reward_detail, source_adn: r.adn }]}
dataSource={[{
...r.reward_detail,
source_adn: r.reward_detail.adn ?? r.adn,
}]}
pagination={false}
size="small"
scroll={{ x: 900 }}
@@ -1126,24 +1212,19 @@ export default function AdRevenueReportPage() {
</div>
) : (
<div>
<Typography.Text strong></Typography.Text>{' '}
<Typography.Text type="secondary">(,,)</Typography.Text>
<Descriptions size="small" column={3} bordered style={{ marginTop: 8 }}>
<Descriptions.Item label="时间">{formatUtcTime(r.created_at)}</Descriptions.Item>
<Descriptions.Item label="eCPM(分)">{r.ecpm ?? '-'}</Descriptions.Item>
<Descriptions.Item label="eCPM(元)">
{r.ecpm != null && !Number.isNaN(Number(r.ecpm))
? (Number(r.ecpm) / 100).toFixed(2)
: '-'}
</Descriptions.Item>
<Descriptions.Item label="预估收益(元)">
{r.has_impression ? r.revenue_yuan.toFixed(4) : '-'}
</Descriptions.Item>
<Descriptions.Item label="底层 ADN">{r.adn ?? '-'}</Descriptions.Item>
<Descriptions.Item label="底层代码位(rit)">{r.slot_id ?? '-'}</Descriptions.Item>
<Descriptions.Item label="我方代码位">{r.our_code_id ?? '-'}</Descriptions.Item>
<Descriptions.Item label="来源应用">{r.app_env ?? '-'}</Descriptions.Item>
</Descriptions>
<Typography.Text strong>广</Typography.Text>{' '}
<Typography.Text type="secondary">
( 1 · 0 / 0)
</Typography.Text>
<Table<AdRevenueDetailRow>
style={{ marginTop: 8 }}
rowKey="record_id"
columns={DETAIL_COLUMNS}
dataSource={[impressionOnlyDetail(r)]}
pagination={false}
size="small"
scroll={{ x: 900 }}
/>
</div>
),
}}
+2 -2
View File
@@ -237,9 +237,9 @@ export default function ComparisonRecordsPage() {
key: 'user',
width: 140,
render: (_, r) => (
<div>
<div style={{ color: '#1677ff' }}>
<div>{r.phone || `#${r.user_id}`}</div>
{r.nickname && <div style={{ color: '#999', fontSize: 12 }}>{r.nickname}</div>}
{r.nickname && <div style={{ fontSize: 12 }}>{r.nickname}</div>}
</div>
),
},
+22 -4
View File
@@ -122,13 +122,31 @@ const renderReview = (f: Feedback) => {
// 机型 / OS版本(提交反馈时的端环境;改版前历史反馈无 → -)
const renderDeviceOs = (f: Feedback) => {
const os = [f.android_version ? `Android ${f.android_version}` : null, f.rom_name]
const modelName = f.device_model_name || f.device_model;
const rawModel =
f.device_model_name && f.device_model_name !== f.device_model ? f.device_model : null;
const romHasVersion = /\d/.test(f.rom_name || '');
const vendorOs = [
f.rom_name,
f.rom_version && !romHasVersion ? f.rom_version : null,
]
.filter(Boolean)
.join(' ');
const os = [
vendorOs || null,
f.android_version ? `Android ${f.android_version}` : null,
]
.filter(Boolean)
.join(' · ');
if (!f.device_model && !os) return <Text type="secondary">-</Text>;
if (!modelName && !os) return <Text type="secondary">-</Text>;
return (
<Space direction="vertical" size={0}>
<Text>{f.device_model || '-'}</Text>
<Text>{modelName || '-'}</Text>
{rawModel ? (
<Text type="secondary" style={{ fontSize: 12 }}>
{[f.device_manufacturer, rawModel].filter(Boolean).join(' · ')}
</Text>
) : null}
{os ? (
<Text type="secondary" style={{ fontSize: 12 }}>
{os}
@@ -352,7 +370,7 @@ export default function FeedbacksPage() {
{
title: '机型 / OS版本',
key: 'device',
width: 150,
width: 180,
render: (_: unknown, f: Feedback) => renderDeviceOs(f),
},
{
+5
View File
@@ -0,0 +1,5 @@
import { WithdrawReviewPage } from '../withdraws/WithdrawReviewPage';
export default function InviteWithdrawsPage() {
return <WithdrawReviewPage mode="invite" />;
}
+24 -7
View File
@@ -75,7 +75,8 @@ const NAV_GROUPS: NavGroup[] = [
icon: <MoneyCollectOutlined />,
label: '奖励审核',
children: [
{ key: '/withdraws', icon: <MoneyCollectOutlined />, label: '提现审核' },
{ key: '/invite-withdraws', icon: <MoneyCollectOutlined />, label: '邀请提现审核' },
{ key: '/withdraws', icon: <MoneyCollectOutlined />, label: '其他提现审核' },
{ key: '/price-reports', icon: <FlagOutlined />, label: '低价审核' },
{ key: '/feedbacks', icon: <MessageOutlined />, label: '用户反馈' },
],
@@ -91,6 +92,7 @@ const NAV_GROUPS: NavGroup[] = [
{ key: '/users', icon: <UserOutlined />, label: '用户管理' },
],
},
{ key: '/admins', icon: <TeamOutlined />, label: '权限管理' },
{
key: 'monitoring-audit',
icon: <FileSearchOutlined />,
@@ -103,7 +105,6 @@ const NAV_GROUPS: NavGroup[] = [
{ key: '/audit-logs', icon: <FileSearchOutlined />, label: '审计日志' },
],
},
{ key: '/admins', icon: <TeamOutlined />, label: '权限管理' },
];
// 导航项 key(/dashboard)→ 权限页 key(dashboard),与后端 permissions.py 目录对齐
@@ -144,8 +145,13 @@ export default function MainLayout({ children }: { children: React.ReactNode })
const version = (reviewRefreshVersion.current[key] ?? 0) + 1;
reviewRefreshVersion.current[key] = version;
let count: number;
if (key === '/withdraws') {
count = (await api.get<WithdrawSummary>('/admin/api/withdraws/summary')).data.reviewing_count;
if (key === '/withdraws' || key === '/invite-withdraws') {
const source = key === '/invite-withdraws' ? 'invite_cash' : 'coin_cash';
count = (
await api.get<WithdrawSummary>('/admin/api/withdraws/summary', {
params: { source },
})
).data.reviewing_count;
} else if (key === '/price-reports') {
count = (await api.get<PriceReportSummary>('/admin/api/price-reports/summary')).data.pending;
} else {
@@ -158,6 +164,7 @@ export default function MainLayout({ children }: { children: React.ReactNode })
const refreshSafely = (key: ReviewBadgeKey) => refresh(key).catch(() => {});
void Promise.all([
refreshSafely('/withdraws'),
refreshSafely('/invite-withdraws'),
refreshSafely('/price-reports'),
refreshSafely('/feedbacks'),
]);
@@ -223,8 +230,7 @@ export default function MainLayout({ children }: { children: React.ReactNode })
position: 'sticky',
top: 0,
height: '100vh',
overflowY: 'auto',
overflowX: 'hidden',
overflow: 'hidden',
}}
>
<nav className={`side-nav${collapsed ? ' side-nav-collapsed' : ''}`} aria-label="后台导航">
@@ -314,8 +320,19 @@ export default function MainLayout({ children }: { children: React.ReactNode })
.side-nav {
display: flex;
flex-direction: column;
box-sizing: border-box;
gap: 4px;
padding: 0 10px 14px;
height: calc(100vh - 48px);
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
overscroll-behavior: contain;
padding: 0 10px 20px;
scrollbar-gutter: stable;
-webkit-overflow-scrolling: touch;
}
.side-nav:focus-within {
scroll-behavior: smooth;
}
.nav-group {
padding: 6px 0 8px;
+65 -10
View File
@@ -13,6 +13,11 @@ import { formatUtcTime } from '@/lib/format';
import { usePagedList } from '@/lib/usePagedList';
import { AdjustCashModal, AdjustCoinModal } from '@/components/AdjustBalanceModals';
import { DeleteUserModal } from '@/components/DeleteUserModal';
import {
clearUserRisk,
UserRiskModal,
type RiskUser,
} from '@/components/UserRiskModal';
import type { UserListItem } from '@/lib/types';
const { RangePicker } = DatePicker;
@@ -49,6 +54,7 @@ export default function UsersPage() {
const [coinUser, setCoinUser] = useState<UserListItem | null>(null);
const [cashUser, setCashUser] = useState<UserListItem | null>(null);
const [delUser, setDelUser] = useState<UserListItem | null>(null);
const [riskUser, setRiskUser] = useState<RiskUser | null>(null);
const [selectedRowKeys, setSelectedRowKeys] = useState<Key[]>([]);
// 筛选/排序变化后清空已选(避免选中项跨筛选错位)
@@ -134,6 +140,22 @@ export default function UsersPage() {
});
};
const markNormalRisk = (u: UserListItem) => {
modal.confirm({
title: `确认将用户 ${u.phone} 标记为非高风险?`,
content: '确认后将清空当前高风险备注。',
onOk: async () => {
try {
await clearUserRisk(u.id);
message.success('已标记为非高风险');
reload();
} catch (error) {
message.error(errMsg(error));
}
},
});
};
// 一次性操作:点一下把该用户标记为「未看过引导」,下次打开 App 重看一遍,看完后端自动恢复(只触发这一次)。
// 用户尚未重看前可「撤销」(把 force_onboarding 置回 false),纠正误点。
const setForceOnboarding = (u: UserListItem, enable: boolean) => {
@@ -213,26 +235,38 @@ export default function UsersPage() {
};
const columns: ColumnsType<UserListItem> = [
{ title: 'ID', dataIndex: 'id', width: 80, sorter: true, sortOrder: sortOrderOf('id') },
{ title: '手机号', dataIndex: 'phone', width: 130 },
{ title: 'ID', dataIndex: 'id', width: 60, sorter: true, sortOrder: sortOrderOf('id') },
{ title: '手机号', dataIndex: 'phone', width: 115 },
{
title: '昵称',
dataIndex: 'nickname',
width: 150,
width: 130,
ellipsis: true,
render: (v: string | null) => v || '-',
},
{ title: '渠道', dataIndex: 'register_channel', width: 90 },
{
title: '用户标识',
dataIndex: 'is_high_risk',
width: 95,
render: (_: boolean, user: UserListItem) => (
<Tooltip title={user.is_high_risk ? user.high_risk_note || '暂无高风险备注' : undefined}>
<Tag color={user.is_high_risk ? 'red' : 'default'}>
{user.is_high_risk ? '高风险' : '非高风险'}
</Tag>
</Tooltip>
),
},
{ title: '渠道', dataIndex: 'register_channel', width: 70 },
{
title: '状态',
dataIndex: 'status',
width: 90,
width: 80,
render: (s: string) => <Tag color={STATUS_COLOR[s]}>{s}</Tag>,
},
{
title: '注册时间',
dataIndex: 'created_at',
width: 160,
width: 140,
sorter: true,
sortOrder: sortOrderOf('created_at'),
render: (v: string) => formatUtcTime(v),
@@ -245,7 +279,7 @@ export default function UsersPage() {
</Tooltip>
),
dataIndex: 'last_active_at',
width: 160,
width: 140,
sorter: true,
// 关掉 antd 默认的「点击升序/降序」表头提示,否则与上面自定义口径 Tooltip 同时弹出互相遮挡
showSorterTooltip: false,
@@ -256,9 +290,14 @@ export default function UsersPage() {
title: '操作',
key: 'op',
fixed: 'right',
width: 340,
width: 540,
render: (_: unknown, u: UserListItem) => (
<Space wrap={false} onClick={(e) => e.stopPropagation()}>
<Space
size={6}
wrap={false}
style={{ whiteSpace: 'nowrap' }}
onClick={(e) => e.stopPropagation()}
>
<a onClick={() => router.push(`/users/${u.id}`)}></a>
{canCoins && <a onClick={() => setCoinUser(u)}></a>}
{canCoins && <a onClick={() => setCashUser(u)}></a>}
@@ -270,6 +309,16 @@ export default function UsersPage() {
{u.debug_trace_enabled ? '关调试链接' : '开调试链接'}
</a>
)}
{canStatus &&
u.status !== 'deleted' &&
(u.is_high_risk ? (
<>
<a onClick={() => setRiskUser(u)}></a>
<a onClick={() => markNormalRisk(u)}></a>
</>
) : (
<a onClick={() => setRiskUser(u)}></a>
))}
{canStatus &&
u.status !== 'deleted' &&
(u.force_onboarding ? (
@@ -392,7 +441,7 @@ export default function UsersPage() {
showTotal: (t) => `${t} 个用户`,
onChange: onPageChange,
}}
scroll={{ x: 1200 }}
scroll={{ x: 1400 }}
onChange={onTableChange}
/>
@@ -404,6 +453,12 @@ export default function UsersPage() {
onClose={() => setDelUser(null)}
onDone={reload}
/>
<UserRiskModal
user={riskUser}
open={!!riskUser}
onClose={() => setRiskUser(null)}
onDone={reload}
/>
</div>
);
}
+51 -20
View File
@@ -4,11 +4,13 @@ import { useCallback, useEffect, useState } from 'react';
import {
DatePicker,
Descriptions,
Input,
Radio,
Space,
Table,
Tag,
Typography,
Tooltip,
message,
} from 'antd';
import type { ColumnsType } from 'antd/es/table';
@@ -39,12 +41,18 @@ const PAGE_SIZE = 10; // 金币记录每页条数
interface Props {
userId: number;
user: WithdrawUserSnapshot | null;
withdrawSource?: 'coin_cash' | 'invite_cash';
// 统计区字段集:withdraw(默认,提现详情:含提现细分) / ad(广告收益详情:只看看广告观看统计,对齐参考图 6 项)
statsVariant?: 'withdraw' | 'ad';
}
/** 用户看广告/提现详情:基本信息 + 互斥时间筛选 + 统计区(按 statsVariant 取字段集)+ 金币发放记录表。 */
export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw' }: Props) {
export default function UserRewardPanel({
userId,
user,
withdrawSource,
statsVariant = 'withdraw',
}: Props) {
const [mode, setMode] = useState<'all' | 'range'>('all'); // all=注册至今 / range=自定义区间
const [range, setRange] = useState<[Dayjs, Dayjs] | null>(null);
const [stats, setStats] = useState<UserRewardStats | null>(null);
@@ -69,7 +77,10 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
setStatsLoading(true);
try {
const { data } = await api.get<UserRewardStats>(`/admin/api/users/${userId}/reward-stats`, {
params: JSON.parse(paramsKey),
params: {
...JSON.parse(paramsKey),
...(withdrawSource ? { withdraw_source: withdrawSource } : {}),
},
});
setStats(data);
} catch (e) {
@@ -77,7 +88,7 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
} finally {
setStatsLoading(false);
}
}, [userId, paramsKey]);
}, [userId, paramsKey, withdrawSource]);
const loadRecords = useCallback(
async (p: number) => {
@@ -135,6 +146,13 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
<Space size="large" wrap>
<span>
<Text strong>{user?.phone || '-'}</Text>
{user && (
<Tooltip title={user.is_high_risk ? user.high_risk_note || '暂无高风险备注' : undefined}>
<Tag color={user.is_high_risk ? 'red' : 'default'} style={{ marginInlineStart: 8 }}>
{user.is_high_risk ? '高风险' : '非高风险'}
</Tag>
</Tooltip>
)}
</span>
<span>
<Text strong>{user?.nickname || '-'}</Text>
@@ -160,6 +178,7 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
<RangePicker
size="small"
disabled={mode !== 'range'}
allowEmpty={[true, true]}
value={range}
onChange={(v) => setRange(v as [Dayjs, Dayjs] | null)}
/>
@@ -168,7 +187,7 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
{/* 统计区(受时间筛选;现金余额为当前快照)。ad 视图只保留看广告观看统计(对齐参考图 6 项) */}
<Descriptions bordered size="small" column={2} style={{ marginBottom: 8 }}>
<Descriptions.Item label="累计提现">
<Descriptions.Item label="累计成功提现">
{stats ? yuan(stats.withdraw_success_cents) : '-'}
</Descriptions.Item>
<Descriptions.Item label="现金余额">
@@ -176,40 +195,40 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
</Descriptions.Item>
{statsVariant === 'ad' ? (
<>
<Descriptions.Item label="激励视频观看数">
<Descriptions.Item label="激励视频成功发奖次数">
{stats?.reward_video_count ?? '-'}
</Descriptions.Item>
{/* eCPM 均按元展示(reward_video / feed avg_ecpm 原始为分/千次,÷100 转元) */}
<Descriptions.Item label="平均激励视频ECPM">
<Descriptions.Item label="预估平均激励视频ECPM">
{stats ? `${(stats.reward_video_avg_ecpm / 100).toFixed(2)} 元/千` : '-'}
</Descriptions.Item>
<Descriptions.Item label="draw信息流视频观看数">
<Descriptions.Item label="Draw信息流奖励份数">
{stats?.feed_count ?? '-'}
</Descriptions.Item>
<Descriptions.Item label="平均draw信息流ECPM">
<Descriptions.Item label="预估平均Draw信息流ECPM">
{stats ? `${(stats.feed_avg_ecpm / 100).toFixed(2)} 元/千` : '-'}
</Descriptions.Item>
</>
) : (
<>
<Descriptions.Item label="提现总次数">{stats?.withdraw_total ?? '-'}</Descriptions.Item>
<Descriptions.Item label="传统任务提现">
<Descriptions.Item label="提现申请总次数">{stats?.withdraw_total ?? '-'}</Descriptions.Item>
<Descriptions.Item label="传统任务累计收益">
{stats ? yuan(stats.traditional_task_cash_cents) : '-'}
</Descriptions.Item>
<Descriptions.Item label="累计激励视频数">
<Descriptions.Item label="激励视频成功发奖次数">
{stats?.reward_video_count ?? '-'}
</Descriptions.Item>
<Descriptions.Item label="平均激励视频ECPM">
<Descriptions.Item label="预估平均激励视频ECPM">
{stats ? `${stats.reward_video_avg_ecpm} 分/千` : '-'}
</Descriptions.Item>
<Descriptions.Item label="激励视频提现">
<Descriptions.Item label="激励视频累计收益">
{stats ? yuan(stats.reward_video_cash_cents) : '-'}
</Descriptions.Item>
<Descriptions.Item label="累计信息流广告数">{stats?.feed_count ?? '-'}</Descriptions.Item>
<Descriptions.Item label="平均信息流广告ECPM">
<Descriptions.Item label="信息流奖励份数">{stats?.feed_count ?? '-'}</Descriptions.Item>
<Descriptions.Item label="预估平均信息流广告ECPM">
{stats ? `${stats.feed_avg_ecpm} 分/千` : '-'}
</Descriptions.Item>
<Descriptions.Item label="信息流广告提现">
<Descriptions.Item label="信息流广告累计收益">
{stats ? yuan(stats.feed_cash_cents) : '-'}
</Descriptions.Item>
</>
@@ -217,12 +236,24 @@ export default function UserRewardPanel({ userId, user, statsVariant = 'withdraw
</Descriptions>
<Text type="secondary" style={{ fontSize: 12 }}>
{statsVariant === 'ad'
? '统计随上方时间筛选(现金余额除外,为当前快照);eCPM 均按元展示(原始分/千次 ÷100)。'
: '统计随上方时间筛选(现金余额除外,为当前快照);eCPM 单位分/千次,同金币审计。'}
? '统计随上方时间筛选(现金余额除外,为当前快照);次数仅统计成功发奖记录,信息流按奖励份数统计;eCPM 为预估值。'
: '统计随上方时间筛选(现金余额除外,为当前快照);提现按申请提交时间统计;累计收益为已发金币按当前汇率折算,不代表实际已提现金额;eCPM 为预估值。'}
</Text>
{/* 金币记录 */}
<h4 style={{ margin: '16px 0 8px' }}></h4>
{user?.is_high_risk && (
<div style={{ marginTop: 16 }}>
<Text strong></Text>
<Input.TextArea
readOnly
value={user.high_risk_note || ''}
rows={3}
style={{ marginTop: 8 }}
/>
</div>
)}
{/* 主要金币发放记录 */}
<h4 style={{ margin: '16px 0 8px' }}></h4>
<Table
rowKey={(r) => `${r.source}-${r.created_at}-${r.coin}-${r.ecpm ?? ''}`}
size="small"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+18 -5
View File
@@ -1,13 +1,26 @@
'use client';
import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { getToken } from '@/lib/auth';
export default function Home() {
const router = useRouter();
useEffect(() => {
router.replace(getToken() ? '/dashboard' : '/login');
}, [router]);
return null;
window.location.replace(getToken() ? '/dashboard' : '/login');
}, []);
return (
<main
style={{
minHeight: '100vh',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
background: '#f0f2f5',
color: '#595959',
fontFamily: 'system-ui, sans-serif',
}}
>
</main>
);
}
+81
View File
@@ -0,0 +1,81 @@
'use client';
import { useEffect, useState } from 'react';
import { App, Input, Modal } from 'antd';
import { api, errMsg } from '@/lib/api';
export type RiskUser = {
id: number;
phone: string;
is_high_risk: boolean;
high_risk_note: string | null;
};
type Props = {
user: RiskUser | null;
open: boolean;
onClose: () => void;
onDone: () => void | Promise<void>;
};
export function UserRiskModal({ user, open, onClose, onDone }: Props) {
const { message } = App.useApp();
const [note, setNote] = useState('');
const [saving, setSaving] = useState(false);
useEffect(() => {
if (open) setNote(user?.high_risk_note ?? '');
}, [open, user]);
const save = async () => {
if (!user) return;
const trimmed = note.trim();
if (!trimmed) {
message.warning('请输入标记为高风险的原因');
return;
}
setSaving(true);
try {
await api.post(`/admin/api/users/${user.id}/risk`, {
is_high_risk: true,
note: trimmed,
});
message.success(user.is_high_risk ? '高风险备注已更新' : '已标记为高风险');
await onDone();
onClose();
} catch (error) {
message.error(errMsg(error));
} finally {
setSaving(false);
}
};
return (
<Modal
title="高风险备注"
open={open}
okText="保存"
confirmLoading={saving}
onOk={save}
onCancel={onClose}
destroyOnHidden
>
<Input.TextArea
autoFocus
rows={5}
maxLength={500}
showCount
value={note}
placeholder="请输入标记为高风险的原因"
onChange={(event) => setNote(event.target.value)}
/>
</Modal>
);
}
export async function clearUserRisk(userId: number) {
await api.post(`/admin/api/users/${userId}/risk`, {
is_high_risk: false,
note: null,
});
}
+5 -1
View File
@@ -1,4 +1,8 @@
export type ReviewBadgeKey = '/withdraws' | '/price-reports' | '/feedbacks';
export type ReviewBadgeKey =
| '/invite-withdraws'
| '/withdraws'
| '/price-reports'
| '/feedbacks';
export const REVIEW_BADGE_REFRESH_EVENT = 'review-badge-refresh';
+34 -21
View File
@@ -52,6 +52,8 @@ export interface UserListItem {
status: string;
// 调试链接权限:开了的用户在 App 比价结果页/记录页可复制 price.shaguabijia.com 的 trace 调试链接
debug_trace_enabled: boolean;
is_high_risk: boolean;
high_risk_note: string | null;
// 运营「一键开启新手引导」:true = 该用户下次打开 App 会被强制重走新手引导,走完自动取消
force_onboarding: boolean;
wechat_openid: string | null;
@@ -143,7 +145,6 @@ export interface WithdrawOrder {
amount_cents: number;
// 提现类型:coin_cash(福利页提现,金币兑换现金) / invite_cash(邀请提现,邀请奖励金)
source: string;
user_name: string | null;
status: string; // reviewing / pending / success / failed / rejected
wechat_state: string | null;
transfer_bill_no: string | null;
@@ -157,6 +158,8 @@ export interface WithdrawOrder {
export interface WithdrawListItem extends WithdrawOrder {
phone: string | null;
nickname: string | null;
is_high_risk: boolean;
high_risk_note: string | null;
cumulative_success_cents: number; // 累计成功提现(分)
}
@@ -164,7 +167,10 @@ export interface WithdrawSummary {
reviewing_count: number;
reviewing_amount_cents: number;
pending_count: number;
success_count: number;
rejected_count: number;
failed_count: number;
total_count: number;
today_success_count: number;
today_success_amount_cents: number;
today_rejected_count: number;
@@ -174,6 +180,8 @@ export interface WithdrawUserSnapshot {
id: number;
phone: string;
nickname: string | null;
is_high_risk: boolean;
high_risk_note: string | null;
status: string;
wechat_nickname: string | null;
wechat_avatar_url: string | null;
@@ -184,14 +192,34 @@ export interface WithdrawUserSnapshot {
withdraw_success_cents: number;
}
export interface InviteeDetail {
user_id: number;
phone: string;
registered_at: string;
invite_success: boolean;
first_compare_store: string | null;
first_compare_products: string | null;
first_order_store: string | null;
first_order_products: string | null;
first_order_amount_cents: number | null;
}
export interface InviteOverview {
invite_total: number;
invite_success_total: number;
items: InviteeDetail[];
}
export interface WithdrawDetail {
order: WithdrawOrder;
user: WithdrawUserSnapshot | null;
cumulative_success_cents: number;
risk_flags: string[];
risk_score: number;
recent_withdraws: WithdrawOrder[];
recent_cash_transactions: CashTxn[];
audit_logs: AuditLog[];
invite_overview: InviteOverview | null;
}
// 提现详情抽屉「用户统计区」:按时间窗口算的提现 + 看广告行为统计。
@@ -318,26 +346,6 @@ export interface WithdrawBulkResult {
items: WithdrawBulkItemResult[];
}
export interface WithdrawLedgerCheck {
ok: boolean;
// 普通现金账(coin_cash)
cash_balance_total_cents: number;
cash_transaction_total_cents: number;
balance_diff_cents: number;
missing_withdraw_txn_count: number;
missing_refund_txn_count: number;
duplicate_refund_txn_count: number;
refund_txn_on_non_terminal_count: number;
// 邀请奖励金账(invite_cash:与普通现金物理隔离,各自对账)
invite_cash_balance_total_cents: number;
invite_cash_transaction_total_cents: number;
invite_balance_diff_cents: number;
invite_missing_withdraw_txn_count: number;
invite_missing_refund_txn_count: number;
invite_duplicate_refund_txn_count: number;
invite_refund_txn_on_non_terminal_count: number;
}
export interface WxpayHealthCheck {
ok: boolean;
wxpay_configured: boolean;
@@ -377,7 +385,10 @@ export interface Feedback {
// 提交端环境快照:提交版本号 / 机型OS版本;改版前的历史反馈为 null
app_version: string | null;
device_model: string | null;
device_model_name: string | null;
device_manufacturer: string | null;
rom_name: string | null;
rom_version: number | null;
android_version: string | null;
// 联表瞬态:展示完整手机号(点手机号查该用户全部反馈)
phone: string | null;
@@ -542,6 +553,8 @@ export interface AdRevenueRecord {
expected_coin: number;
actual_coin: number;
matched: boolean;
adn: string | null; // 本条发奖对应的实际填充 ADN
slot_id: string | null; // 本条发奖对应的底层 mediation rit
}
// 广告收益报表:按日期汇总的一天(按天趋势图用;全量,不受分页影响)