Files
nl-video-api/test_movie_api.http
2025-08-03 00:11:15 +08:00

238 lines
6.6 KiB
Go
Raw 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.
### 影片管理API测试
### 1. 创建影片电影类型 - 自动提取封面
POST http://localhost:8000/api/v1/movies
Content-Type: application/json
Authorization: Bearer {{token}}
{
"title": "复仇者联盟4终局之战",
"original_title": "Avengers: Endgame",
"category_id": 1,
"type": 1,
"area": "美国",
"language": "英语",
"year": 2019,
"duration": 181,
"director": "安东尼·罗素, 乔·罗素",
"actor": "小罗伯特·唐尼, 克里斯·埃文斯, 马克·鲁法洛, 克里斯·海姆斯沃斯, 斯嘉丽·约翰逊",
"description": "超级英雄们与灭霸的最终决战,拯救宇宙的史诗级大片。",
"tags": "动作,科幻,冒险",
"video_url": "/uploads/videos/avengers_endgame.mp4",
"is_vip": 1,
"is_recommend": 1,
"is_hot": 1,
"is_new": 0,
"sort": 1
}
### 2. 创建影片电视剧类型 - 手动上传封面
POST http://localhost:8000/api/v1/movies
Content-Type: application/json
Authorization: Bearer {{token}}
{
"title": "权力的游戏",
"original_title": "Game of Thrones",
"category_id": 2,
"type": 2,
"area": "美国",
"language": "英语",
"year": 2011,
"duration": 60,
"director": "大卫·贝尼奥夫, D·B·威斯",
"actor": "彼特·丁拉基, 琳娜·海蒂, 艾米莉亚·克拉克, 基特·哈灵顿",
"description": "基于乔治·R·R·马丁的奇幻小说《冰与火之歌》改编的史诗级电视剧。",
"tags": "奇幻,剧情,战争",
"poster": "/uploads/posters/game_of_thrones_poster.jpg",
"banner": "/uploads/banners/game_of_thrones_banner.jpg",
"is_vip": 1,
"is_recommend": 1,
"is_hot": 1,
"is_new": 0,
"sort": 2
}
### 3. 获取影片列表
GET http://localhost:8000/api/v1/movies?page=1&page_size=10
Authorization: Bearer {{token}}
### 4. 搜索影片
GET http://localhost:8000/api/v1/movies/search?keyword=复仇者&page=1&page_size=10
Authorization: Bearer {{token}}
### 5. 获取热门影片
GET http://localhost:8000/api/v1/movies/hot?limit=5
Authorization: Bearer {{token}}
### 6. 获取推荐影片
GET http://localhost:8000/api/v1/movies/recommend?limit=5
Authorization: Bearer {{token}}
### 7. 获取最新影片
GET http://localhost:8000/api/v1/movies/new?limit=5
Authorization: Bearer {{token}}
### 8. 根据分类获取影片
GET http://localhost:8000/api/v1/movies/category/1?page=1&page_size=10
Authorization: Bearer {{token}}
### 9. 获取影片详情
GET http://localhost:8000/api/v1/movies/1
Authorization: Bearer {{token}}
### 10. 更新影片信息
PUT http://localhost:8000/api/v1/movies/1
Content-Type: application/json
Authorization: Bearer {{token}}
{
"title": "复仇者联盟4终局之战更新版",
"description": "超级英雄们与灭霸的最终决战,拯救宇宙的史诗级大片。更新后的描述。",
"is_hot": 1,
"is_recommend": 1
}
### 11. 批量更新影片状态
PUT http://localhost:8000/api/v1/movies/batch
Content-Type: application/json
Authorization: Bearer {{token}}
{
"ids": [1, 2],
"field": "is_recommend",
"value": 1
}
### 12. 上传视频文件
POST http://localhost:8000/api/v1/movies/upload/video
Content-Type: multipart/form-data
Authorization: Bearer {{token}}
### 13. 上传封面图片
POST http://localhost:8000/api/v1/movies/upload/poster
Content-Type: multipart/form-data
Authorization: Bearer {{token}}
### 14. 删除影片
DELETE http://localhost:8000/api/v1/movies/1
Authorization: Bearer {{token}}
### ===== 集数管理API测试 =====
### 15. 为电视剧创建集数
POST http://localhost:8000/api/v1/episodes
Content-Type: application/json
Authorization: Bearer {{token}}
{
"movie_id": 2,
"episode_num": 1,
"title": "第一集:凛冬将至",
"description": "权力的游戏第一季第一集,故事的开始。",
"video_url": "/uploads/episodes/got_s01e01.mp4",
"video_size": 1073741824,
"video_format": "mp4",
"resolution": "1920x1080",
"is_vip": 1,
"sort": 1
}
### 16. 批量创建集数
POST http://localhost:8000/api/v1/episodes/batch
Content-Type: application/json
Authorization: Bearer {{token}}
{
"movie_id": 2,
"episodes": [
{
"episode_num": 2,
"title": "第二集:王者大道",
"description": "权力的游戏第一季第二集。",
"video_url": "/uploads/episodes/got_s01e02.mp4",
"video_size": 1073741824,
"video_format": "mp4",
"resolution": "1920x1080",
"is_vip": 1,
"sort": 2
},
{
"episode_num": 3,
"title": "第三集:雪诺大人",
"description": "权力的游戏第一季第三集。",
"video_url": "/uploads/episodes/got_s01e03.mp4",
"video_size": 1073741824,
"video_format": "mp4",
"resolution": "1920x1080",
"is_vip": 1,
"sort": 3
}
]
}
### 17. 获取影片的所有集数
GET http://localhost:8000/api/v1/episodes/movie/2
Authorization: Bearer {{token}}
### 18. 获取集数详情
GET http://localhost:8000/api/v1/episodes/1
Authorization: Bearer {{token}}
### 19. 更新集数信息
PUT http://localhost:8000/api/v1/episodes/1
Content-Type: application/json
Authorization: Bearer {{token}}
{
"title": "第一集:凛冬将至(更新版)",
"description": "权力的游戏第一季第一集,故事的开始。更新后的描述。",
"is_vip": 0
}
### 20. 上传集数视频
POST http://localhost:8000/api/v1/episodes/upload/video
Content-Type: multipart/form-data
Authorization: Bearer {{token}}
### 21. 生成视频缩略图
POST http://localhost:8000/api/v1/episodes/thumbnail
Content-Type: application/json
Authorization: Bearer {{token}}
{
"video_url": "/uploads/episodes/got_s01e01.mp4"
}
### 22. 获取视频信息
GET http://localhost:8000/api/v1/episodes/video/info?video_url=/uploads/episodes/got_s01e01.mp4
Authorization: Bearer {{token}}
### 23. 批量更新集数状态
PUT http://localhost:8000/api/v1/episodes/batch/status
Content-Type: application/json
Authorization: Bearer {{token}}
{
"ids": [1, 2, 3],
"status": 1
}
### 24. 删除集数
DELETE http://localhost:8000/api/v1/episodes/1
Authorization: Bearer {{token}}
### ===== 数据库初始化测试 =====
### 25. 初始化数据库命令行执行
# 在项目根目录执行
# go run main.go init-db
### ===== 注意事项 =====
# 1. 所有需要认证的接口都需要在请求头中添加 Authorization: Bearer {{token}}
# 2. {{token}} 需要先通过登录接口获取
# 3. 文件上传接口需要使用 multipart/form-data 格式
# 4. 电影类型(type=1)会自动从视频中提取封面需要提供video_url
# 5. 电视剧类型(type=2)需要手动上传封面需要提供poster字段
# 6. 视频处理功能需要系统安装ffmpeg
# 7. 批量操作建议分批进行避免一次性操作过多数据