feat(dramas): add play count field for drama records

1. 新增plays字段到DramaRecord接口和swagger/openapi文档
2. 在剧集创建时默认设置plays为0
3. 新增getPlayCountsByDramaIds方法聚合剧集播放量
4. 在后台和前台剧集列表中添加播放量数据
5. 更新测试用例适配新增的plays字段
This commit is contained in:
2026-07-02 18:25:58 +08:00
parent 03d3c2f9cc
commit 55e20f9f16
6 changed files with 142 additions and 44 deletions

View File

@@ -91,13 +91,13 @@
"/api/app/v1/dramas/presearch": {
"get": {
"tags": ["App Dramas"],
"summary": "关键字预查询视频列表",
"operationId": "presearchAppDramaVideos",
"summary": "短剧名称预查询",
"operationId": "presearchAppDramasByTitle",
"parameters": [
{
"name": "keyword",
"in": "query",
"description": "用户输入关键字;空值返回空列表",
"description": "短剧名称关键字;空值返回空列表",
"required": false,
"schema": {
"type": "string"
@@ -119,7 +119,7 @@
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/VideoPresearchPage"
"$ref": "#/components/schemas/AppDramaPage"
}
}
}
@@ -407,7 +407,7 @@
},
"AppDrama": {
"type": "object",
"required": ["id", "title", "coverUrl", "type", "tags", "status", "sortOrder", "isRecommended", "onlineVersion", "totalEpisodes", "publishedEpisodes", "createdAt", "updatedAt"],
"required": ["id", "title", "coverUrl", "type", "tags", "status", "sortOrder", "isRecommended", "onlineVersion", "totalEpisodes", "publishedEpisodes", "plays", "createdAt", "updatedAt"],
"properties": {
"id": { "type": "integer", "example": 1 },
"tiktokAlbumId": { "type": "string", "nullable": true },
@@ -426,6 +426,7 @@
"onlineVersion": { "type": "integer", "example": 1 },
"totalEpisodes": { "type": "integer", "example": 20 },
"publishedEpisodes": { "type": "integer", "example": 10 },
"plays": { "type": "integer", "example": 12345 },
"createdAt": { "type": "string", "format": "date-time" },
"updatedAt": { "type": "string", "format": "date-time" }
}
@@ -500,36 +501,6 @@
"pagination": { "$ref": "#/components/schemas/Pagination" }
}
},
"VideoPresearchItem": {
"type": "object",
"required": ["id", "dramaId", "episodeNo", "title", "coverUrl", "durationSeconds", "freeType", "price", "dramaTitle", "dramaCoverUrl"],
"properties": {
"id": { "type": "integer", "example": 1 },
"dramaId": { "type": "integer", "example": 1 },
"episodeNo": { "type": "integer", "example": 1 },
"title": { "type": "string", "example": "Pilot Video Match" },
"description": { "type": "string", "nullable": true },
"coverUrl": { "type": "string", "example": "https://cdn.example.com/episode.jpg" },
"durationSeconds": { "type": "integer", "example": 180 },
"byteplusVid": { "type": "string", "nullable": true },
"videoUrl": { "type": "string", "nullable": true },
"freeType": { "type": "string", "enum": ["free", "paid"], "example": "free" },
"price": { "type": "integer", "example": 0 },
"dramaTitle": { "type": "string", "example": "Skyline Keyword Saga" },
"dramaCoverUrl": { "type": "string", "example": "https://cdn.example.com/drama.jpg" }
}
},
"VideoPresearchPage": {
"type": "object",
"required": ["list", "pagination"],
"properties": {
"list": {
"type": "array",
"items": { "$ref": "#/components/schemas/VideoPresearchItem" }
},
"pagination": { "$ref": "#/components/schemas/Pagination" }
}
},
"UpsertPlaybackHistoryRequest": {
"type": "object",
"required": ["episodeId", "progressSeconds"],