1.发布房源信息
Request:
method: POST
api/v1.0/houses
{
"title":"上奥世纪中心",
"price":"666",
"area_id":"5",
"address":"西三旗桥东建材城1号",
"room_count":"2",
"acreage":"60",
"unit":"2室1厅",
"capacity":"3",
"beds":"双人床2张",
"deposit":"200",
"min_days":"3",
"max_days":"0",
"facility":["1","2","3","7","12","14","16","17","18","21","22"]
}
Response
返回成功:
{
"errno": "0",
"errmsg": "成功"
"data" :{
"house_id": "1"
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
2.上传房源图片信息
Request:
method: POST
api/v1.0/houses/3/images 备注:3 表示 房源ID
图片二进制数据
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBLmWAHlsrAAaInSze-cQ719.jpg"
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
3.请求当前用户已发布房源信息
Request:
method: GET
api/v1.0/user/houses
no input data
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"houses": [
{
"address": "西三旗桥东",
"area_name": "昌平区",
"ctime": "2017-11-06 11:16:24",
"house_id": 1,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBJY-AL3m8AAS8K2x8TDE052.jpg",
"order_count": 0,
"price": 100,
"room_count": 2,
"title": "上奥世纪中心",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBLFeALIEjAADexS5wJKs340.png"
},
{
"address": "北清路郑上路",
"area_name": "顺义区",
"ctime": "2017-11-06 11:38:54",
"house_id": 2,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBKtmAC8y8AAZcKg5PznU817.jpg",
"order_count": 0,
"price": 1000,
"room_count": 1,
"title": "修正大厦302教室",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBLFeALIEjAADexS5wJKs340.png"
}
]
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
4.请求房源详细信息
Request:
method: GET
api/v1.0/houses/1 备注:1 表示 房源ID
no input data
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"house": {
"acreage": 80,
"address": "西三旗桥东",
"beds": "2双人床",
"capacity": 3,
"comments": [
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
},
{
"comment": "评论的内容",
"ctime": "2017-11-12 12:30:30",
"user_name": "评论人的姓名"
}
],
"deposit": 200,
"facilities": [9,11,13,16,19,20,21,23],
"hid": 1,
"img_urls": [
"http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBJY-AL3m8AAS8K2x8TDE052.jpg",
"http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBJZmAYqGWAAaInSze-cQ230.jpg"
],
"max_days": 30,
"min_days": 1,
"price": 100,
"room_count": 2,
"title": "上奥世纪中心",
"unit": "3室3厅",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBLFeALIEjAADexS5wJKs340.png",
"user_id": 1,
"user_name": "Aceld"
},
"user_id": 1
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
5.请求房屋搜索信息
Request:
method: GET
api/v1.0/houses?aid=5&sd=2017-11-12&ed=2017-11-30&sk=new&p=1
no input data
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"current_page": 1,
"houses": [
{
"address": "西三旗桥东",
"area_name": "昌平区",
"ctime": "2017-11-06 11:16:24",
"house_id": 1,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBJY-AL3m8AAS8K2x8TDE052.jpg",
"order_count": 0,
"price": 100,
"room_count": 2,
"title": "上奥世纪中心13号楼",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBLFeALIEjAADexS5wJKs340.png"
},
{
"address": "西三旗桥东",
"area_name": "昌平区",
"ctime": "2017-11-06 11:16:24",
"house_id": 1,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBJY-AL3m8AAS8K2x8TDE052.jpg",
"order_count": 0,
"price": 100,
"room_count": 2,
"title": "上奥世纪中心18号楼",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oBLFeALIEjAADexS5wJKs340.png"
}
],
"total_page": 1
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
6.首页请求房屋列表展示信息
Request:
method: GET
api/v1.0/houses/index
no input data
Response
返回成功
{
"errno": "0",
"errmsg": "成功",
"data": [
{
"address": "昌平区北清路郑上路修正大厦4楼",
"area_name": "昌平区",
"ctime": "2017-11-26 07:49:46",
"house_id": 1,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1obw6eAdFGmAABMXSdIwrQ736.jpg",
"order_count": 1,
"price": 20000,
"room_count": 4,
"title": "修正大厦4楼407教室",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oeWLOAYMDRAAFRjYb_8O4884.jpg"
},
{
"address": "西三旗桥东上奥世纪中心2号楼3单元1603",
"area_name": "昌平区",
"ctime": "2017-11-26 08:01:54",
"house_id": 2,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1obxnqATAcEAAEfUlwSF7M040.jpg",
"order_count": 1,
"price": 7000,
"room_count": 2,
"title": "上奥世纪中心",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1oeWLOAYMDRAAFRjYb_8O4884.jpg"
},
{
"address": "北京市在哪里",
"area_name": "昌平区",
"ctime": "2017-11-26 16:18:52",
"house_id": 3,
"img_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1obynmAWx-VAAFGMJZmvjE696.jpg",
"order_count": 1,
"price": 1000000,
"room_count": 30,
"title": "四合院",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1obydaAIqtvAAAlne0-FP4361.jpg"
},
{
"address": "1234",
"area_name": "通州区",
"ctime": "2017-11-27 10:33:55",
"house_id": 4,
"img_url": "http://101.200.170.171:9998/",
"order_count": 0,
"price": 12300,
"room_count": 1324,
"title": "241",
"user_avatar": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1ob6fqAFgKrAADnmQOYVr0711.jpg"
},
{
"address": "小胡同",
"area_name": "东城区",
"ctime": "2017-11-27 14:29:32",
"house_id": 5,
"img_url": "http://101.200.170.171:9998/",
"order_count": 0,
"price": 34500,
"room_count": 5,
"title": "sad",
"user_avatar": "http://101.200.170.171:9998/"
}
]
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}