基础域名:https://soulapi.quwanzhi.com(正式)/ https://souldev.quwanzhi.com(开发)
GET /api/book/all-chapters # 无需认证,返回全部章节 curl https://soulapi.quwanzhi.com/api/book/all-chapters
响应:{"success": true, "data": [{"id":"1.1", "sectionTitle":"...", "isFree":true, "price":0, ...}]}
GET /api/book/chapter/:id curl https://soulapi.quwanzhi.com/api/book/chapter/1.1
响应:{"success": true, "data": {"id":"1.1", "content":"# 正文...", ...}}
POST /api/admin
Content-Type: application/json
{"username": "admin", "password": "admin123"}
# 响应包含 token,后续请求需带 Authorization: Bearer {token}
GET /api/db/book?action=list
Authorization: Bearer {token}
# 返回所有章节的元数据(不含正文)
GET /api/db/book?action=read&id={section_id}
Authorization: Bearer {token}
POST /api/db/book
Authorization: Bearer {token}
Content-Type: application/json
{
"id": "1.6", // 章节ID,不传则自动生成
"title": "章节标题",
"content": "Markdown正文",
"price": 1.0, // 定价,0=免费
"partId": "part-1", // 所属篇
"chapterId": "chapter-1" // 所属章
}
支持从 Cursor Skill / 命令行 直接写入数据库:
# 命令行方式
python3 content_upload.py \
--title "标题" \
--price 1.0 \
--content "正文内容" \
--part part-1 \
--chapter chapter-1 \
--format markdown
# JSON方式
python3 content_upload.py --json '{
"title": "标题",
"price": 1.0,
"content": "正文...",
"part_id": "part-1",
"chapter_id": "chapter-1",
"images": ["https://img.com/1.png"]
}'
# 查看篇章结构
python3 content_upload.py --list-structure
# 列出所有章节
python3 content_upload.py --list-chapters
DELETE /api/admin/content/:id
Authorization: Bearer {token}
curl -X DELETE https://soulapi.quwanzhi.com/api/admin/content/1.6 \
-H "Authorization: Bearer {token}"
# 如需直连数据库 Host: 56b4c23f6853c.gz.cdb.myqcloud.com Port: 14413 User: cdb_outerroot DB: soul_miniprogram 表: chapters (mid自增主键, id章节号唯一索引)