# EPUB 文件配置说明 ## 测试文件放置 为了测试在线阅读功能,请将 EPUB 格式的测试文件放置在以下位置: ``` public/static/books/sample.epub ``` ## 目录结构 ``` public/ └── static/ └── books/ └── sample.epub (测试用的 EPUB 文件) ``` ## 后续集成 实际使用时,应该: 1. 在后端添加图书文件上传功能 2. 在图书表中添加 `file_path` 或 `file_url` 字段 3. 修改前端阅读器,从后端 API 获取文件 URL 4. 支持多种格式:EPUB, PDF, MOBI 等 ## API 接口建议 ### 获取图书文件 URL ``` GET /api/CrudBookModelViewSet/{id}/file/ Response: { "file_url": "http://example.com/books/xxx.epub", "file_type": "epub" } ``` ### 保存阅读进度 ``` POST /api/reading-progress/ { "book_id": 1, "location": "epubcfi(...)", "progress": 45.5 } ``` ### 获取阅读进度 ``` GET /api/reading-progress/{book_id}/ Response: { "location": "epubcfi(...)", "progress": 45.5, "updated_at": "2025-10-20T10:00:00Z" } ``` ### 翻译接口 ``` POST /api/translate/ { "text": "Hello World", "target_lang": "zh" } Response: { "translation": "你好世界" } ```