.. _book: 书籍 =========== 获取热门书籍(概要) ~~~~~~~~~~~ **URL**:: GET /book/hot_list **Response** `200`: .. sourcecode:: json [ { "author": "陈儒", "fav_nums": 0, "id": 18, "image": "https://img3.doubanio.com/lpic/s3435132.jpg", "like_status": 0, "title": "Python源码剖析" }, { "author": "MarkPilgrim", "fav_nums": 0, "id": 58, "image": "https://img3.doubanio.com/lpic/s29631790.jpg", "like_status": 0, "title": "Dive Into Python" }, { "author": "MarkPilgrim", "fav_nums": 0, "id": 65, "image": "https://img3.doubanio.com/lpic/s4059293.jpg", "like_status": 0, "title": "Dive Into Python 3" }, ] **response_description**: * fav_nums:点赞数 * id: 书籍id * like_status: 是否点赞 * author: 作者 * title: 书籍题目 * image: 书籍图片 返回一个列表,包含所有热门书籍的概要信息 获取书籍短评 ~~~~~~~~~~~~~~~~~ **URL**:: GET /book//short_comment **Parameters**: * book_id:书籍的id,必填,必须为正整数 **Response** `200`: .. sourcecode:: json { "comment": [ { "content": "i hate6!", "nums": 1 } ], "book_id": 1 } **Response_description**: * comment: 一个评论的列表,包含用户对书籍的评论及对应数量的字典 * book_id: 书籍id 获取喜欢书籍数量 ~~~~~~~~~~~~~~~~~~~~~~~~ **URL**:: GET /book/favor/count **Response** `200`: .. sourcecode:: json { "count": 10, } **Response_description**: * count: 返回我喜欢的书籍数量 获取书籍点赞情况 ~~~~~~~~~~~~~~~~~~~~~~~~ **URL**:: GET /book//favor **Parameters**: * book_id:书籍的id,必填,必须为正整数 **Response** `200`: .. sourcecode:: json { "fav_nums": 0, "id": 1, "like_status": 0 } 新增短评 ~~~~~~~~~~~~~~~~~~~~~~~~ **URL**:: POST /book/add/short_comment **Parameters**: * book_id:书籍id * content:评论内容,我们可允许的评论内容范围为12字以内 **Response** `201`: .. sourcecode:: json { "error_code": 0, "msg": "ok", "request": "POST /book/add_short_comment" } 获取热搜关键字 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **URL**:: GET /book/hot_keyword **Response** `200`:: { "hot": [ "Fluent Python", "Python", "小程序Java核心编程", "慕课网7七月", "微信小程序开发入门与实践", "C++" ] } 书籍搜索 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **URL**:: GET /book/search **Parameters**: * start: 开始记录数,默认为0 * count: 记录条数,默认为20,超过依然按照20条计算 * summary: 返回完整或简介,默认为0,0为完整内容,1为简介 * q:搜索内容,比如你想搜索python相关书籍,则输入python **Response** `200`: 当summary=0,返回详细数据:: { "books": [ { "author": [ "Luciano Ramalho" ], "binding": "Paperback", "category": "编程", "id": 195, "image": "https://img3.doubanio.com/lpic/s27935775.jpg", "images": { "large": "https://img3.doubanio.com/lpic/s27935775.jpg" }, "isbn": "9781491946008", "pages": "768", "price": "USD 39.99", "pubdate": "2015-8-20", "publisher": "O'Reilly Media", "subtitle": "", "summary": "Learn how to write idiomatic, effective Python code by leveraging its best features... }, { "author": [ "【英】大卫•加里夫", "David Gariff" ], "binding": "精装", "category": "艺术史", "id": 44307, "image": "https://img3.doubanio.com/lpic/s27145681.jpg", "images": { "large": "https://img3.doubanio.com/lpic/s27145681.jpg" }, "isbn": "9787511719164", "pages": "192", "price": "98.00元", "pubdate": "2014-1", "publisher": "中央编译出版社", "subtitle": "名画密码与大师传承", "summary": "《艺术谱系》一书以独特的视角构建出一部通俗易懂的西方艺术发展史... "translator": [ "徐效军" ] } ], "count": 2, "start": 0, "total": 2 } 当summary=1,返回概要数据:: { "books": [ { "author": [ "Luciano Ramalho" ], "id": 195, "image": "https://img3.doubanio.com/lpic/s27935775.jpg", "isbn": "9781491946008", "price": "USD 39.99", "title": "Fluent Python" }, { "author": [ "【英】大卫•加里夫", "David Gariff" ], "id": 44307, "image": "https://img3.doubanio.com/lpic/s27145681.jpg", "isbn": "9787511719164", "price": "98.00元", "title": "艺术谱系" } ], "count": 2, "start": 0, "total": 2 } **Response_description**: 返回包含书籍详细内容或简介内容的列表 获取书籍详细信息 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **URL**:: GET /book//detail **Parameters**: * id: 书籍的id号 **Response** `200`:: { "author": [ "Wolfgang Mauerer" ], "binding": "平装", "category": "算法", "id": 6980, "image": "https://img1.doubanio.com/lpic/s4368169.jpg", "images": { "large": "https://img1.doubanio.com/lpic/s4368169.jpg" }, "isbn": "9787115227430", "pages": "1038", "price": "149.00元", "pubdate": "201005", "publisher": "人民邮电出版社", "subtitle": "全球开源社区集体智慧结晶,领略Linux内核的绝美风光", "summary": "众所周知,Linux操作系统的源代码复杂、文档少,对程序员的要求高,要想看懂这些代码并不是一件容易事...", "title": "深入Linux内核架构", "translator": [ "郭旭" ] }