GET /api/book/today-recommend?limit=8limit: 返回数量,默认8本GET /api/book/bestsellers?limit=10limit: 返回数量,默认10本SELECT * FROM books
WHERE status = 1
ORDER BY created_at DESC
LIMIT #{limit}
SELECT * FROM books
WHERE status = 1
ORDER BY read_count DESC, view_count DESC
LIMIT #{limit}
getTodayRecommend(limit): 获取今日推荐getBestsellers(limit): 获取畅销书籍onLoad 生命周期中调用API获取数据onShow 生命周期中刷新数据image 字段,其次 cover 字段,最后使用默认图片)loadTodayRecommend() 和 loadBestsellers()id: 书籍IDtitle: 书名author: 作者image: 图片URLcover: 封面URLbrief: 简介desc: 描述introduction: 详细介绍id: 书籍ID(用于跳转详情页)title: 书名author: 作者image: 图片URL(优先使用 image,其次 cover,最后默认图片)desc: 描述(优先使用 desc,其次 brief,最后 introduction)cd book
mvn spring-boot:run
在微信开发者工具中打开 books 项目
image 或 cover 字段有有效的图片URLbooks/utils/config.js 中的 BASE_URL)请求示例:
GET /api/book/today-recommend?limit=8
响应示例:
{
"code": 200,
"message": null,
"data": [
{
"id": 1,
"title": "西游记",
"author": "(明) 吴承恩",
"image": "https://example.com/image.jpg",
"cover": "https://example.com/cover.jpg",
"brief": "简介",
"desc": "描述",
"introduction": "详细介绍",
...
}
]
}
请求示例:
GET /api/book/bestsellers?limit=10
响应示例:
{
"code": 200,
"message": null,
"data": [
{
"id": 1,
"title": "西游记",
"author": "(明) 吴承恩",
"image": "https://example.com/image.jpg",
"cover": "https://example.com/cover.jpg",
"brief": "简介",
"desc": "描述",
"introduction": "详细介绍",
"readCount": 100,
"viewCount": 500,
...
}
]
}
创建时间:2024年 最后更新:2024年