diff --git a/src/app/(main)/users/page.tsx b/src/app/(main)/users/page.tsx index 5969784..f13ea44 100644 --- a/src/app/(main)/users/page.tsx +++ b/src/app/(main)/users/page.tsx @@ -68,6 +68,25 @@ export default function UsersPage() { }); }; + const toggleDebugTrace = (u: UserListItem) => { + const next = !u.debug_trace_enabled; + Modal.confirm({ + title: `确认${next ? '开启' : '关闭'}用户 ${u.phone} 的调试链接权限?`, + content: next + ? '开启后,该用户在 App 比价结果页/记录页可复制 trace 调试链接发给开发排障' + : undefined, + onOk: async () => { + try { + await api.post(`/admin/api/users/${u.id}/debug-trace`, { enabled: next }); + message.success('已更新调试链接权限'); + reload(); + } catch (e) { + message.error(errMsg(e)); + } + }, + }); + }; + const columns: ColumnsType = [ { title: 'ID', dataIndex: 'id', width: 70 }, { title: '手机号', dataIndex: 'phone' }, @@ -94,6 +113,11 @@ export default function UsersPage() { {canStatus && u.status !== 'deleted' && ( toggleStatus(u)}>{u.status === 'active' ? '封禁' : '解封'} )} + {canStatus && u.status !== 'deleted' && ( + toggleDebugTrace(u)}> + {u.debug_trace_enabled ? '关调试链接' : '开调试链接'} + + )} ), }, diff --git a/src/lib/types.ts b/src/lib/types.ts index 6ff6cd0..4b3af4b 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -27,6 +27,8 @@ export interface UserListItem { nickname: string | null; register_channel: string; status: string; + // 调试链接权限:开了的用户在 App 比价结果页/记录页可复制 price.shaguabijia.com 的 trace 调试链接 + debug_trace_enabled: boolean; wechat_openid: string | null; created_at: string; last_login_at: string;