前台 收藏模块 - d4smart/Traveller GitHub Wiki
1. 添加收藏
/collection/add post
request
guideId
必需:guideId
response
fail
{
"code": 1,
"msg": "参数错误/要收藏的攻略不存在/攻略未发布,不能收藏/添加收藏失败/不能重复收藏攻略"
}
success
{
"code": 0,
"msg": "添加收藏成功"
}
2. 获取自己的所有收藏
/collection/list get
request
pageNum,pageSize
必需:无
response
success
{
"code": 0,
"data": {
"list": [
{
"id": 2,
"title": "帝都十日起居录",
"authorId": 1,
"author": {
"username": "d4smart",
"avatar": "/image/2018/04/1524021960416.jpg"
},
"places": "北京",
"thumbnail": "/image/2018/03/1522401804448.jpeg",
"views": 7,
"likes": 2,
"comments": 0,
"createTime": "2018-04-02 15:59:22",
"updateTime": "2018-05-10 10:23:23"
},
{
"id": 3,
"title": "上海光影",
"authorId": 1,
"author": {
"username": "d4smart",
"avatar": "/image/2018/04/1524021960416.jpg"
},
"places": "上海",
"thumbnail": "/images/2018/03/1522401513524.png",
"views": 13,
"likes": 2,
"comments": 0,
"createTime": "2018-04-02 16:01:21",
"updateTime": "2018-05-10 16:19:35"
},
{
"id": 15488,
"title": "武汉站",
"authorId": 6,
"author": {
"username": "yat140",
"avatar": "/image/2018/05/1525232310539.jpg"
},
"places": "武汉",
"thumbnail": "/image/2018/05/1525832604836.jpg",
"views": 5,
"likes": 0,
"comments": 2,
"createTime": "2018-05-09 10:23:25",
"updateTime": "2018-05-10 10:23:24"
}
],
"pageNum": 1,
"pageSize": 10,
"totalPage": 1,
"totalRow": 3
}
}
3. 是否收藏了攻略
/collection/isCollected get
request
guideId
必需:guideId
response
fail
{
"code": 1,
"msg": "参数错误/没有收藏这篇攻略"
}
success
{
"code": 0,
"msg": "收藏了这篇攻略"
}
4. 删除收藏
/collection/delete post
request
guideId
必需:guideId
response
fail
{
"code": 1,
"msg": "参数错误/收藏不存在/取消收藏失败"
}
success
{
"code": 0,
"msg": "取消收藏成功"
}