diff --git a/服务参考_临时/Brisk API接口与示例文档.md b/服务参考_临时/Brisk API接口与示例文档.md index 6455fde..e03318e 100644 --- a/服务参考_临时/Brisk API接口与示例文档.md +++ b/服务参考_临时/Brisk API接口与示例文档.md @@ -289,9 +289,38 @@ curl -X POST "https://brisk.lightyears.ltd/api/archives/slot/1/upload" \ - `content_size_bytes` - `content_checksum` - `like_count` +- `today_like_count` +- `liked_by_me` +- `like_reset_at` - `visit_count` - `updated_at` +点赞接口说明: + +- 点赞按 `Asia/Shanghai` 自然日分周期 +- 同一玩家对同一空间同一天重复点赞时: + - 接口仍返回成功 + - `created=false` + - `like_count` 与 `today_like_count` 不会继续增加 +- `DELETE /like` 只会撤销当前周期内的那一次点赞 +- 支持给自己的空间点赞 + +点赞列表说明: + +- `GET /api/spaces/{player_id}/likes` +- `GET /api/spaces/by-login/likes` +- 支持可选查询参数 `scope` + - `history`:历史点赞记录,默认值 + - `cycle`:当前周期内的点赞记录 +- `limit` 最大返回 `100` + +最近访问列表说明: + +- `GET /api/spaces/me/visits` +- 支持可选查询参数 `limit` +- 默认返回 `50` 条 +- 单次最大返回 `100` 条 + 上传表单字段: - `base_version`:用于乐观锁;首次上传可传 `0` @@ -332,6 +361,26 @@ curl -X POST "https://brisk.lightyears.ltd/api/spaces/by-login/like?login_provid -H "Authorization: Bearer " ``` +按第三方身份查询当前周期点赞列表示例: + +```bash +curl "https://brisk.lightyears.ltd/api/spaces/by-login/likes?login_provider=tap&login_user_id=tap_user_10001&scope=cycle&limit=20" \ + -H "Authorization: Bearer " +``` + +点赞返回示例: + +```json +{ + "liked": true, + "created": true, + "liked_by_me": true, + "like_count": 128, + "today_like_count": 17, + "like_reset_at": "2026-04-22T00:00:00+08:00" +} +``` + ## 10. 后台项目与配置 ### 10.1 项目 diff --git a/服务参考_临时/Brisk 错误码文档(内部实施版).md b/服务参考_临时/Brisk 错误码文档(内部实施版).md index b06221f..24c662b 100644 --- a/服务参考_临时/Brisk 错误码文档(内部实施版).md +++ b/服务参考_临时/Brisk 错误码文档(内部实施版).md @@ -217,6 +217,7 @@ | `70040` | `spaces/{player_id}/likes` | 缺少空间目标参数 | | `70041` | `spaces/{player_id}/likes` | 玩家不存在 | | `70042` | `spaces/{player_id}/likes` | 点赞列表查询失败 | +| `70043` | `spaces/{player_id}/likes` | 点赞列表 scope 参数非法 | | 错误码 | 接口/模块 | 含义 | |---|---|---| diff --git a/服务参考_临时/README.md b/服务参考_临时/README.md index 92e125a..d59088f 100644 --- a/服务参考_临时/README.md +++ b/服务参考_临时/README.md @@ -76,6 +76,9 @@ docker compose up --build - 主信息接口返回空间元数据 - 自定义空间内容通过独立二进制接口上传/下载 - 支持任意 bytes,兼容二进制、文本、JSON、protobuf、msgpack 等格式 + - 空间点赞按 `Asia/Shanghai` 自然日计周期,同一玩家对同一空间每天最多记一次点赞 + - 空间点赞相关接口返回累计点赞数 `like_count`、当日点赞数 `today_like_count`、当日是否已点赞 `liked_by_me` + - 最近访问列表支持可选 `limit` 参数,默认 `50` 条,最大 `100` 条 ## 测试脚本 @@ -84,6 +87,7 @@ Windows PowerShell: ```powershell .\scripts\smoke-test.ps1 .\scripts\acceptance.ps1 -Tasks all -ManageStack +.\\scripts\\acceptance.ps1 -Tasks space -ManageStack ``` ## 迁移 @@ -93,6 +97,7 @@ Windows PowerShell: - [0001_init.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0001_init.sql) - [0008_identity_and_config_simplification.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0008_identity_and_config_simplification.sql) - [0009_space_binary_content.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0009_space_binary_content.sql) +- [0010_space_like_daily_cycle.sql](/F:/OtherWork/BriskGameSerivce/internal/platform/db/migrations/0010_space_like_daily_cycle.sql) 服务启动时会自动执行未应用迁移。 diff --git a/服务参考_临时/openapi.yaml b/服务参考_临时/openapi.yaml index 34b084d..5a5ce52 100644 --- a/服务参考_临时/openapi.yaml +++ b/服务参考_临时/openapi.yaml @@ -413,11 +413,17 @@ components: like_count: type: integer format: int64 + today_like_count: + type: integer + format: int64 visit_count: type: integer format: int64 liked_by_me: type: boolean + like_reset_at: + type: string + format: date-time updated_at: type: string format: date-time @@ -452,9 +458,15 @@ components: like_count: type: integer format: int64 + today_like_count: + type: integer + format: int64 visit_count: type: integer format: int64 + like_reset_at: + type: string + format: date-time updated_at: type: string format: date-time @@ -482,9 +494,19 @@ components: properties: liked: type: boolean + created: + type: boolean + liked_by_me: + type: boolean like_count: type: integer format: int64 + today_like_count: + type: integer + format: int64 + like_reset_at: + type: string + format: date-time SpaceVisitItem: type: object properties: @@ -509,6 +531,13 @@ components: created_at: type: string format: date-time + SpaceLikeListResponse: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/SpaceLikeItem' paths: /client/time: get: @@ -915,15 +944,20 @@ paths: - in: query name: limit schema: { type: integer } + - in: query + name: scope + schema: + type: string + enum: [history, cycle] + default: history + description: Whether to list historical likes or only likes from the current daily cycle. responses: '200': description: Space likes content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/SpaceLikeItem' + $ref: '#/components/schemas/SpaceLikeListResponse' /spaces/me/content: put: tags: [spaces] @@ -1079,15 +1113,20 @@ paths: - in: query name: limit schema: { type: integer } + - in: query + name: scope + schema: + type: string + enum: [history, cycle] + default: history + description: Whether to list historical likes or only likes from the current daily cycle. responses: '200': description: Space likes content: application/json: schema: - type: array - items: - $ref: '#/components/schemas/SpaceLikeItem' + $ref: '#/components/schemas/SpaceLikeListResponse' /spaces/by-login/like: post: tags: [spaces] @@ -1139,7 +1178,8 @@ paths: parameters: - in: query name: limit - schema: { type: integer } + schema: { type: integer, default: 50 } + description: Optional page size. Defaults to 50 and is capped at 100. responses: '200': description: Visitor list