Files
2026-07-09 14:24:46 +08:00

53 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# GET /admin/api/users/{user_id} — 用户 360 详情
> 所属:Admin·用户 组(前缀 `/admin/api/users` | 鉴权:Bearer admin_token(角色:任意已登录管理员,无 require_role | [← 返回 API 索引](../../README.md)
## 入参
- 路径:`user_id`(int)
## 出参
响应 `200`:`AdminUserOverview`(基础资料 + 钱包余额 + 各项 count;历史明细走各自分页接口)
| 字段 | 类型 | 说明 |
|---|---|---|
| `user` | AdminUserListItem | 用户基础资料,字段见下 |
| `coin_balance` | int | 当前金币余额(个数);无金币账户时为 0 |
| `cash_balance_cents` | int | 当前现金余额(分);无账户时为 0 |
| `total_coin_earned` | int | 累计获得金币(个数);无账户时为 0 |
| `comparison_total` | int | 比价记录总数 |
| `comparison_success` | int | 比价成功数(`status=success`) |
| `withdraw_total` | int | 提现单总数 |
| `withdraw_success_cents` | int | 提现成功累计金额(分,`status=success` 之和) |
| `feedback_total` | int | 反馈总数 |
**AdminUserListItem**(`user` 字段)
| 字段 | 类型 | 说明 |
|---|---|---|
| `id` | int | 用户 id |
| `phone` | string | 手机号 |
| `nickname` | string \| null | 昵称,可空 |
| `register_channel` | string | 注册渠道 |
| `status` | string | 用户状态:`active` / `disabled` / `deleted` |
| `wechat_openid` | string \| null | 微信 openid,可空 |
| `created_at` | datetime | 注册时间(UTC) |
| `last_login_at` | datetime | 上次登录时间(UTC) |
## 错误码
- `401` 未带/无效/过期 admin token、管理员被禁用(头带 `WWW-Authenticate: Bearer`)
- `404` 用户不存在(`detail: "用户不存在"`)
- `422` `user_id` 非整数
## 说明
- 金币三项(`coin_balance` / `cash_balance_cents` / `total_coin_earned`)读 [coin_account](../../../database/coin_account.md);从未发生金币动作(账户不存在)时统一返回 0。
- 各 count 为聚合数,明细历史走带 `user_id` 过滤的分页接口(金币流水 / 现金流水 / 提现 / 比价 / 反馈)。
- 关联用户表 [user](../../../database/user.md);金币账户 [coin_account](../../../database/coin_account.md);提现单 [withdraw_order](../../../database/withdraw_order.md);比价记录 [comparison_record](../../../database/comparison_record.md);反馈 [feedback](../../../database/feedback.md)。
---
## 族内配套端点(提现详情页联查用)
| 方法 + 路径 | 说明 |
|---|---|
| `GET /admin/api/users/{user_id}/reward-stats` | 用户提现/看广告统计(按时间窗口):提现审核时评估该用户金币来源是否健康 |
| `GET /admin/api/users/{user_id}/coin-records` | 用户金币发放记录(按时间窗口分页):提现详情底部表,逐笔看发币来源 |