# 用户积分流水 API 文档 本文档描述了用户积分流水相关的接口规范,整合了积分收入和支出记录。 ## 1. 积分流水查询 (收入+支出) * **URL**: `/v2/user/points/record/statement` * **Method**: `GET` * **描述**: 分页查询用户的积分流水记录,统一展示积分的收入和支出情况。 ### 请求参数 | 字段名 | 类型 | 必填 | 说明 | | :--- | :--- | :--- | :--- | | `page` | integer | 否 | 页码,默认 1 | | `size` | integer | 否 | 每页大小,默认 10 | | `userId` | long | 否 | 用户ID | | `type` | integer | 否 | 流水类型 1:收入 2:支出(不传则查全部) | | `startTime` | string | 否 | 开始时间 (yyyy-MM-dd HH:mm:ss) | | `endTime` | string | 否 | 结束时间 (yyyy-MM-dd HH:mm:ss) | ### 响应参数 (`data` 字段) 返回 Mybatis-Plus `Page` 对象,包含 `records` (记录列表), `total` (总数), `size` (页大小), `current` (当前页) 等。 `records` 中的对象 (`UserPointsStatementVO`) 结构如下: | 字段名 | 类型 | 说明 | | :--- | :--- | :--- | | `userId` | long | 用户ID | | `type` | integer | 流水类型 1:收入 2:支出 | | `points` | long | 变动点数 | | `title` | string | 标题/描述(仅支出记录有值,收入记录为 null,前端根据 businessType 自行展示) | | `businessType` | integer | 来源(仅收入记录)1:购买 2:兑换码 3:签到 4:分享 5:邀请 6:被邀请 7:邀请人使用模板 8:注册 9:投稿 10:评论 11:会员;支出记录为 null | | `createTime` | string | 创建时间 | | `nickname` | string | 用户昵称 | | `email` | string | 用户邮箱 | | `appleUserId` | string | 苹果用户ID | | `originalTransactionId` | string | 原始交易ID | | `platform` | string | 平台 | | `language` | string | 语言 | ### 示例请求 查询全部流水: ```http GET /v2/user/points/record/statement?page=1&size=10&userId=12345 ``` 仅查询收入: ```http GET /v2/user/points/record/statement?page=1&size=10&userId=12345&type=1 ``` 仅查询支出: ```http GET /v2/user/points/record/statement?page=1&size=10&userId=12345&type=2 ``` ### 示例响应 ```json { "code": 200, "message": "success", "success": true, "data": { "records": [ { "userId": 12345, "type": 1, "points": 100, "title": null, "businessType": 1, "createTime": "2023-10-27 10:00:00", "nickname": "User123", "email": "user@example.com", "appleUserId": "apple_123", "originalTransactionId": "txn_123", "platform": "IOS", "language": "zh-CN" }, { "userId": 12345, "type": 2, "points": 50, "title": "购买道具", "businessType": null, "createTime": "2023-10-28 14:30:00", "nickname": "User123", "email": "user@example.com", "appleUserId": "apple_123", "originalTransactionId": "txn_123", "platform": "IOS", "language": "zh-CN" } ], "total": 2, "size": 10, "current": 1, "pages": 1 }, "timestamp": 1698372000000 } ```