# 小程序接口说明
## 通用接口
### 登陆
- `POST /api/login`
- 参数:

参数         |  类型    |   可选  |    备注
----------- |  ------  |  ------   |  --------
code        |  string  | 	必须  |  小程序code

- 响应:
 
```
//满足UnionID返回条件时，返回的JSON数据包
{
    "openid": "OPENID",
    "session_key": "SESSIONKEY",
    "unionid": "UNIONID"
}
```
```
//错误时返回JSON数据包(示例为Code无效)
{
	"errcode": 40029,
	"errmsg": "invalid code"
}
```

### 上传图片
- `POST /api/upload`
- 参数:

参数         |  类型    |   可选  |    备注
----------- |  ------  |  ------   |  --------
photo       |   png/jpeg  | 	必须  |  图片

- 响应:
 
```
{
	"status": 0,
	"path": "/path/photo.jpeg"
}
```
```
{
	"status": -1,
	"message": "error, photo is valid"
}
```
```
{
	"status": -2,
	"message": "error, error message"
}
```

### 添加订单评论
- `POST /api/${order_type}/${order_id}/comment`
- 参数:
参数         |  类型    |   可选  |    备注
----------- |  ------  |  ------   |  --------
title       |  string  |  可选      |   订单评论标题
content     |  text    | 必须       |   评论内容

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 我的订单
- `GET /api/my/orders`
- 参数:

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
code        |  string  | 	必须               |  小程序code

- 响应:

```
{
	"status": 0,
	"data": {
		"houseApplianceCleanOrder": [
			{
				"id": 123456,
				"wechat_id": "wechat_id",
				"appliances": "清洁项目1, 清洁项目1, 清洁项目2, 清洁项目3",
				"adress": "地址",
				"contact": "联系人",
				"phone": "13800138000",
				"price": 12.3,
				"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
				"created_at": "2018-02-16 11:10:56",
				"updated_at": "2018-02-16 12:00:51"
			},
			...
		],
		"houseCleanOrder": [
			{
				"id": 123456,
				"wechat_id": "微信id",
				"type": "清洁类型",
				"area": "清洁面积",
				"adress": "地址",
				"contact": "联系人",
				"phone": "13800138000",
				"price": 12.3,
				"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
				"picture1": "/commom/picture1.jepg",
				"picture2": "/commom/picture2.jepg",
				"picture3": "/commom/picture3.jepg",
				"picture4": "/commom/picture4.jepg",
				"picture5": "/commom/picture5.jepg",
				"created_at": "2018-02-16 11:10:56",
				"updated_at": "2018-02-16 12:00:51"
			},
			...
		],
		"housekeeperOrder": [
			{
				"id": 123456,
				"wechat_id": "wechat_id",
				"contents": ["项目1", "项目1", "项目2", "项目3"],
				"people_num": "2-3人",
				"area": "80-100方",
				"server_time": "2018-08-01",
				"rest": "周日",
				"adress": "地址",
				"contact": "联系人",
				"phone": "13800138000",
				"price": 12.3,
				"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
				"created_at": "2018-02-16 11:10:56",
				"updated_at": "2018-02-16 12:00:51"
			},
			...
		],
		"maternityMatronOrder": [
			{
				"id": 123456,
				"wechat_id": "wechat_id",
				"contents": ["项目1", "项目1", "项目2", "项目3"],
				"people_num": "2-3人",
				"area": "80-100方",
				"server_time": "2018-08-01",
				"rest": "周日",
				"adress": "地址",
				"contact": "联系人",
				"phone": "13800138000",
				"price": 12.3,
				"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
				"created_at": "2018-02-16 11:10:56",
				"updated_at": "2018-02-16 12:00:51"
			},
			...
		],
		"productOrder": [
			{
				"id": 123456,
				"wechat_id": "wechat_id",
				"product_id": 12312313,
				"product_name": "产品名称",
				"unit": 122.3,
				"amount": 1,
				"price": 122.3,
				"remark": "买家备注",
				"info": "卖家备注",
				"adress": "地址",
				"contact": "联系人",
				"phone": "13800138000",
				"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
				"created_at": "2018-02-16 11:10:56",
				"updated_at": "2018-02-16 12:00:51"
			},
			...
		]
	}
}
```


### 修改订单状态
- `POST /api/${order_type}/status`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	必须               |  产品id、活动id、订单id
status      |  integer | 	必须               |  订单状态：0.待处理 1.商家受理 2.待支付 3.已支付

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "状态不能为空！"
}
```

## 服务信息接口
### 创建/修改服务信息
- `POST /api/server/store`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  活动id
server       |  string  | 	必须               |  服务标识
content     |  string  | 	必须               |  内容

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```


## 产品接口
### 创建/修改产品
- `POST /api/product/store`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  产品id
name        |  string  | 	必须               |  产品名称
info        |  text    | 	必须               |  产品信息
color       |  string  |   必须               |  产品款色
price       |  double  | 	必须               |  产品价格
classify    |  string  | 	必须               |  产品分类
status      |  integer | 	可选,默认0          |  产品状态：0.上架, 1.下架

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除产品
- `DELETE /api/product/${id}`
- 参数：无
- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}
```
```
{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某产品

- `GET /api/product/${id}`
- 参数：无
- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"name": "测试名称",
		"info": "测试信息",
		"price": 1234.31,
		"classify": "分类1",
		"color": "款色",
		"collect_num": 765,  //收藏数
		"sell_num": 5,       //销量
		"status": 0,         //0上架, 1下架
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
		}
}
```

### 修改产品状态
- `POST /api/product/status`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  产品id
status      |  integer | 	必须               |  状态：0.上架, 1.下架

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 分页查询产品
- `GET /api/products`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"name": "测试名称",
			"info": "测试信息",
			"price": 1234.31,
			"classify": "分类1",
			"color": "款色",
			"collect_num": 765,  //收藏数
			"sell_num": 5,       //销量
			"status": 0,         //0上架, 1下架
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```

## 保姆订单接口
### 创建/修改订单
- `POST /api/housekeeper_order/store`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  产品id
contents    |  string[]|   必须               |  项目内容, 数组形式，多个数量则出现多次，比如 ['项目1', '项目1', '项目2', '项目2', '项目3']
people_num  |  string  | 	必须               |  人数
server_time |  string  | 	必须               |  服务时间
rest        |  string  | 	必须               |  休息时间
area        |  string  | 	必须               |  房屋面积
address     |  string  | 	必须               |  服务地址
contact     |  string  | 	必须               |  联系人
phone       |  string  | 	必须               |  联系电话
price       |  double  | 	可选               |  订单价格
status      |  integer | 	可选,默认0          |  订单状态：0.待处理 1.商家受理 2.待支付 3.已支付

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /api/housekeeper_order/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /api/housekeeper_order/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"wechat_id": "wechat_id",
		"contents": ["项目1", "项目1", "项目2", "项目3"],
		"people_num": "2-3人",
		"area": "80-100方",
		"server_time": "2018-08-01",
		"rest": "周日",
		"adress": "地址",
		"contact": "联系人",
		"phone": "13800138000",
		"price": 12.3,
		"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
	}
}
```

### 分页查询订单
- `GET /api/housekeeper_orders`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"wechat_id": "wechat_id",
			"contents": ["项目1", "项目1", "项目2", "项目3"],
			"people_num": "2-3人",
			"area": "80-100方",
			"server_time": "2018-08-01",
			"rest": "周日",
			"adress": "地址",
			"contact": "联系人",
			"phone": "13800138000",
			"price": 12.3,
			"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```

## 月嫂订单接口
### 创建/修改订单
- `POST /api/maternity_matron_order/store`
- 参数：

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
id             |  integer | 	创建时空，修改时必须  |  产品id
level          |  string  |   必须               |  月嫂等级
expected_date  |  string  | 	必须               |  预产期
special_demand |  string  | 	必须               |  特殊需求
server_time     |  string  | 	必须               |  服务时间
address        |  string  | 	必须               |  服务地址
contact        |  string  | 	必须               |  联系人
phone          |  string  | 	必须               |  联系电话
price          |  double  | 	可选               |  订单价格
status         |  integer | 	可选,默认0          |  订单状态：0.待处理 1.商家受理 2.待支付 3.已支付

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /api/maternity_matron_order/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /api/maternity_matron_order/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"wechat_id": "wechat_id",
		"level": "8999-10000",
		"expected_date": "2018年12月21日",
		"special_demand": "需要个胸大的",
		"server_time": "2018-12-01至2019-02-01",
		"adress": "地址",
		"contact": "联系人",
		"phone": "13800138000",
		"price": 12.3,
		"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
	}
}
```

### 分页查询订单
- `GET /api/maternity_matron_orders`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"wechat_id": "wechat_id",
			"level": "8999-10000",
			"expected_date": "2018年12月21日",
			"special_demand": "需要个胸大的",
			"server_time": "2018-12-01至2019-02-01",
			"adress": "地址",
			"contact": "联系人",
			"phone": "13800138000",
			"price": 12.3,
			"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```

## 产品订单接口
### 创建/修改订单
- `POST /api/product_order/store`
- 参数：

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
id             |  integer | 	创建时空，修改时必须  |  产品id
product_id     |  integer |   必须               |  产品id
amount         |  integer | 	必须               |  购买数量
remark         |  string  | 	可选               |  买家备注
info           |  string  | 	可选               |  卖家备注
address        |  string  | 	必须               |  服务地址
contact        |  string  | 	必须               |  联系人
phone          |  string  | 	必须               |  联系电话
price          |  double  | 	可选               |  订单价格
status         |  integer | 	可选,默认0          |  订单状态：0.待处理 1.商家受理 2.待支付 3.已支付

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /api/product_order/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /api/product_order/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"wechat_id": "wechat_id",
		"product_id": 12312313,
		"product_name": "产品名称",
		"unit": 122.3,
		"amount": 1,
		"price": 122.3,
		"remark": "买家备注",
		"info": "卖家备注",
		"adress": "地址",
		"contact": "联系人",
		"phone": "13800138000",
		"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
	}
}
```

### 分页查询订单
- `GET /api/product_orders`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"wechat_id": "wechat_id",
			"product_id": 12312313,
			"product_name": "产品名称",
			"unit": 122.3,
			"amount": 1,
			"price": 122.3,
			"remark": "买家备注",
			"info": "卖家备注",
			"adress": "地址",
			"contact": "联系人",
			"phone": "13800138000",
			"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```

## 服务信息接口
### 创建/修改服务信息
- `POST /api/server_info/store`
- 参数：

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
id             |  integer | 	创建时空，修改时必须  |  服务id
server         |  string  | 	必须               |  服务名称
content        |  text    | 	必须               |  服务内容说明
photo          |  string  | 	必须               |  首页显示的图片地址

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /api/server_info/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /api/server_info/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"server": "保姆服务",
		"content": "<html>...</html>",
		"photo": "https://wechat.sotype.com/123.png",
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
	}
}
```

### 分页查询服务
- `GET /api/server_infos`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
            "id": 123456,
            "server": "保姆服务",
            "content": "<html>...</html>",
		    "photo": "https://wechat.sotype.com/123.png",
            "created_at": "2018-02-16 11:10:56",
            "updated_at": "2018-02-16 12:00:51"
        }, 
		...
   ]
}
```



## 分类接口
### 分页查询分类
- `GET /api/classifies`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
            id: 1,
            created_at: "2018-09-09 13:50:50",
            updated_at: "2018-09-09 13:50:50",
            pid: 0,
            name: "家政"
        },
        {
            id: 2,
            created_at: "2018-09-09 13:50:50",
            updated_at: "2018-09-09 13:50:50",
            pid: 0,
            name: "钟点/家庭保洁服务"
        }, 
		...
   ]
}
```

# 后台接口说明
## Header说明
- 除了登入登出接口不需要header，其他需要加上
- Header:

```
{
	"Content-Type": "application/json",
	"Authorization": "Bearer 35d42ce7d3d1380cc8c189fa9594852d"
}
```
### 登陆
- `POST /login`
- 参数:

参数         |  类型    |   可选  |    备注
----------- |  ------  |  ------   |  --------
name        |  string  | 	必须  |  用户名
password    |  string  | 	必须  | 密码

- 响应:
 
```
{
    "status": 0,
    "token": "35d42ce7d3d1380cc8c189fa9594852d"
}
```
```
{
    "status": -1,
    "message": "信息不能为空"
}
```
```
{
    "status": -2,
    "message": "用户不存在或密码错误"
}
```

### 登出
- `POST /logout`
- 参数:无

- 响应:
 
```
{
    "status": 0,
    "message": "登出成功"
}
```

### 上传图片
- `POST /upload`
- 参数:

参数         |  类型    |   可选  |    备注
----------- |  ------  |  ------   |  --------
photo       |   png/jpeg  | 	必须  |  图片

- 响应:
 
```
{
	"status": 0,
	"location": "/path/photo.jpeg"
}
```
```
{
	"status": -1,
	"message": "error, photo is valid"
}
```
```
{
	"status": -2,
	"message": "error, error message"
}
```

### 修改订单金额
- `POST /${order_type}/price`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	必须               |  产品id、活动id、订单id
price      |  double | 	必须                 |  订单金额，单位元

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "金额不能为空！"
}
```


## 分类／服务信息接口
### 创建/修改分类服务信息
- `POST /classify/store`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  id
pid         |  integer | 	顶级分类父id=0      |  父id
name        |  string  | 	必须               |  分类/服务名称
info        |  string  | 	必须               |  描述信息 
summary     |  text    | 	必须               |  富文本简介 
server      |  string  | 	必须               |  服务标题
content     |  text    | 	必须               |  富文本内容
photo       |  string  | 	可选               |  图片位置
location    |  string  | 	可选               |  显示位置,top或bottom

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```
### 分页查询分类服务
- `GET /classifies`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
            "id": 1,
            "created_at": "2018-09-09 13:50:50",
            "updated_at": "2018-09-09 13:50:50",
            "pid": 0,
            "name": "家政",
            "info": "家政",
            "summary": "家政富文本简介",
            "server": "家政,同info,name",
            "content": "家政富文本详情介绍",
            "photo": "https://....png",
            "location": "top/bottom",
        },
        {
            "id": 2,
            "created_at": "2018-09-09 13:50:50",
            "updated_at": "2018-09-09 13:50:50",
            "pid": 0,
            "name": "家政",
            "info": "家政",
            "summary": "家政富文本简介",
            "server": "家政,同info,name",
            "content": "家政富文本详情介绍",
            "photo": "https://....png",
            "location": "top/bottom",
        }, 
		...
   ]
}
```

### 查询分类服务首页
- `GET /classify/home`
- 参数： 无
- 响应:

```
{
    "top": [
        {
            "id": 2,
            "server": "钟点/家庭保洁服务",
            "content": "钟点/家庭保洁服务的详情富文本",
            "photo": "https://wechat.sotype.com/storage/16359f72-b44a-11e8-96f8-529269fb1459.jpg"
        },
        {
            "id": 3,
            "server": "母婴产品",
            "content": "母婴产品的详情富文本",
            "photo": "https://wechat.sotype.com/storage/16359f72-b44a-11e8-96f8-529269fb1459.jpg"
        },
        {
            "id": 4,
            "server": "催乳及产后康复",
            "content": "催乳及产后康复的详情富文本",
            "photo": "https://wechat.sotype.com/storage/16359f72-b44a-11e8-96f8-529269fb1459.jpg"
        }
    ],
    "introduce": "<html>你好</html>",
    "bottom": {
        "id": 6,
        "server": "月嫂",
        "content": "月嫂的详情富文本",
        "photo": "https://wechat.sotype.com/storage/16359f72-b44a-11e8-96f8-529269fb1459.jpg"
    }
}
```

### 修改/保存分类服务首页
- `POST /classify/home`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
content     |  text    | 	必须               |  企业介绍

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```

## 产品接口
### 创建/修改产品
- `POST /product/store`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  产品id
name        |  string  | 	必须               |  产品名称
info        |  text    | 	必须               |  产品信息
color       |  string  |   必须               |  产品款色
price       |  double  | 	必须               |  产品价格
classify    |  string  | 	必须               |  产品分类,跟上面的服务分类无半毛钱关系
status      |  integer | 	可选,默认0          |  产品状态：0.上架, 1.下架
photo       |  string  | 	可选               |  首页图片显示
show        |  int     | 	可选，默认0         |  是否首页显示

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除产品
- `DELETE /product/${id}`
- 参数：无
- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}
```
```
{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某产品

- `GET /product/${id}`
- 参数：无
- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"name": "测试名称",
		"info": "测试信息",
		"price": 1234.31,
		"classify": "分类1",
		"color": "款色",
		"collect_num": 765,  //收藏数
		"sell_num": 5,       //销量
		"photo": "https://.....png",       //图片位置
		"status": 0,         //0上架, 1下架
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
		}
}
```

### 分页查询产品
- `GET /products`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"name": "测试名称",
			"info": "测试信息",
			"price": 1234.31,
			"classify": "分类1",
			"color": "款色",
			"collect_num": 765,  //收藏数
			"sell_num": 5,       //销量
			"photo": "https://.....png",       //图片位置
			"status": 0,         //0上架, 1下架
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```


### 查询产品首页
- `GET /product/home`
- 参数： 无
- 响应:

```
{
    "data": [
        {
            "id": 2,
            "name": "奶瓶",
            "photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
        },
        {
            "id": null,
            "name": null,
            "photo": null
        },
        {
            "id": null,
            "name": null,
            "photo": null
        }
    ],
    "status": 0
}
```

## 保姆订单接口
### 创建/修改订单
- `POST /housekeeper_order/store`
- 参数：

参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
id          |  integer | 	创建时空，修改时必须  |  订单id
classify    |  integer | 	必须               |  订单分类id,同classify接口id
contents    |  string[]|   必须               |  项目内容, 数组形式，多个数量则出现多次，比如 ['项目1', '项目1', '项目2', '项目2', '项目3']
people_num  |  string  | 	必须               |  人数
server_time |  string  | 	必须               |  服务时间
rest        |  string  | 	必须               |  休息时间
area        |  string  | 	必须               |  房屋面积
notes       |  string  | 	可选               |  特殊需求
photo       |  string  | 	可选               |  订单显示图片
address     |  string  | 	必须               |  服务地址
contact     |  string  | 	必须               |  联系人
phone       |  string  | 	必须               |  联系电话
price       |  double  | 	可选               |  订单价格
comment_id  |  integer  | 	可选               |  评论id
comment     |  string  | 	可选               |  评论内容
status      |  integer | 	可选,默认0          |  订单状态：0.待处理 1.待支付 2.已支付 3.关闭 -1.支付失败

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}
```
```
{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /housekeeper_order/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /housekeeper_order/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"classify": 6,
		"wechat_id": "wechat_id",
		"contents": ["项目1", "项目1", "项目2", "项目3"],
		"people_num": "2-3人",
		"area": "80-100方",
		"server_time": "2018-08-01",
		"rest": "周日",
		"adress": "地址",
		"contact": "联系人",
		"phone": "13800138000",
		"price": 12.3,
		"comment_id": 1,
		"comment": 不错"",
		"photo": "https://.....png",       //图片位置
		"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
	}
}
```

### 分页查询订单
- `GET /housekeeper_orders`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"classify": 6,
			"wechat_id": "wechat_id",
			"contents": ["项目1", "项目1", "项目2", "项目3"],
			"people_num": "2-3人",
			"area": "80-100方",
			"server_time": "2018-08-01",
			"rest": "周日",
			"adress": "地址",
			"contact": "联系人",
			"phone": "13800138000",
			"price": 12.3,
			"comment_id": 1,
			"comment": 不错"",
			"photo": "https://.....png",       //图片位置
			"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```

### 分页查询某分类下订单
- `GET /housekeeper_orders`
- 参数： 
参数         |  类型    |   可选               |    备注
----------- |  ------  |  ------------------ |  --------
classify    |  integer | 	必须               |  分类id
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"classify": 6,
			"wechat_id": "wechat_id",
			"contents": ["项目1", "项目1", "项目2", "项目3"],
			"people_num": "2-3人",
			"area": "80-100方",
			"server_time": "2018-08-01",
			"rest": "周日",
			"adress": "地址",
			"contact": "联系人",
			"phone": "13800138000",
			"price": 12.3,
			"comment_id": 1,
			"comment": 不错"",
			"photo": "https://.....png",       //图片位置
			"status": 0, // 0.待处理 1.商家受理 2.待支付 3.已支付
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```


## 月嫂订单接口
### 创建/修改订单
- `POST /maternity_matron_order/store`
- 参数：

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
id             |  integer | 	创建时空，修改时必须  |  产品id
level          |  string  |   必须               |  月嫂等级
expected_date  |  string  | 	必须               |  预产期
special_demand |  string  | 	必须               |  特殊需求
server_time     |  string  | 	必须               |  服务时间
address        |  string  | 	必须               |  服务地址
contact        |  string  | 	必须               |  联系人
phone          |  string  | 	必须               |  联系电话
price          |  double  | 	可选               |  订单价格
comment_id  	  |  integer  | 	可选               |  评论id
comment        |  string  | 	可选               |  评论内容
photo          |  string  | 	可选               |  订单显示图片
status         |  integer | 	可选,默认0          |  订单状态：0.待处理 1.商家受理 2.待支付 3.已支付

- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /maternity_matron_order/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /maternity_matron_order/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 123456,
		"wechat_id": "wechat_id",
		"level": "8999-10000",
		"expected_date": "2018年12月21日",
		"special_demand": "需要个胸大的",
		"server_time": "2018-12-01至2019-02-01",
		"adress": "地址",
		"contact": "联系人",
		"phone": "13800138000",
		"price": 12.3,
		"status": 0, // 订单状态：0.待处理 1.商家受理 2.待支付 3.已支付
		"photo": "https://.....png",       //图片位置
		"created_at": "2018-02-16 11:10:56",
		"updated_at": "2018-02-16 12:00:51"
	}
}
```

### 分页查询订单
- `GET /maternity_matron_orders`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 123456,
			"wechat_id": "wechat_id",
			"level": "8999-10000",
			"expected_date": "2018年12月21日",
			"special_demand": "需要个胸大的",
			"server_time": "2018-12-01至2019-02-01",
			"adress": "地址",
			"contact": "联系人",
			"phone": "13800138000",
			"price": 12.3,
			"comment_id": 1,
			"comment": 不错"",
			"status": 0, // 订单状态：0.待处理 1.商家受理 2.待支付 3.已支付
			"photo": "https://.....png",       //图片位置
			"created_at": "2018-02-16 11:10:56",
			"updated_at": "2018-02-16 12:00:51"
		}, 
		...
   ]
}
```

## 产品订单接口
### 创建/修改订单
- `POST /product_order/store`
- 参数：

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
id             |  integer | 	创建时空，修改时必须  |  产品id
products        |  json    |     必须               |  [{"id": 1, "amount": 1}, {"id": 2, "amount": 2}]
remark         |  string  | 	可选               |  买家备注
info           |  string  | 	可选               |  卖家备注
address        |  string  | 	必须               |  服务地址
contact        |  string  | 	必须               |  联系人
phone          |  string  | 	必须               |  联系电话
comment_id     |  integer  | 	可选               |  评论id
comment        |  string  | 	可选               |  评论内容
status         |  integer | 	可选,默认0          |  订单状态：0.待处理 1.商家受理 2.待支付 3.已支付


- 响应:

```
{
	"status": 0,
	"message": "保存成功"
}

{
	"status": -1,
	"message": "信息不能为空！"
}
```

### 删除订单
- `DELETE /api/product_order/${id}`
- 参数：无

- 响应:

 ```
{
	"status": 0,
	"message": "删除成功"
}

{
	"status": -1,
	"message": "id不能为空！"
}
```

### 获得某订单

- `GET /product_order/${id}`
- 参数：无

- 响应：

 ```
{
	"status": 0,
	"data": {
		"id": 33,
        "created_at": "2018-10-29 08:14:44",
        "updated_at": "2018-10-29 08:14:44",
        "wechat_id": "oMq605Kr5r1-DQPQBtnFraGNQXsw",
        "price": 222.01, 		//订单总价
        "status": 0,
        "remark": null,
        "info": null,
        "contact": "liu",
        "address": "SHENZHEN",
        "phone": "13800138123",
        "comment_id": null,
        "paid_at": null,
        "comment": null,
        "products": [
			{
				...(其他字段，忽略)
				"pivot": {
                        "order_id": 33,
                        "product_id": 5,
                        "product_name": "婴儿车",
                        "product_color": "高端黑",
                        "product_price": 222,
                        "product_amount": 1,
                        "product_photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
                    }
			}, 
			{
				...(其他字段，忽略)
				"pivot": {
                        "order_id": 33,
                        "product_id": 6,
                        "product_name": "玩具",
                        "product_color": "王祖蓝",
                        "product_price": 0.01,
                        "product_amount": 2,
                        "product_photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
                    }
			}
		]
	}
}
```

### 分页查询订单
- `GET /product_orders`
- 参数： 无
- 响应:

```
{
   "total": 50,
   "per_page": 15,
   "current_page": 1,
   "last_page": 4,
   "first_page_url": "http://laravel.app?page=1",
   "last_page_url": "http://laravel.app?page=4",
   "next_page_url": "http://laravel.app?page=2",
   "prev_page_url": null,
   "path": "http://laravel.app",
   "from": 1,
   "to": 15,
   "data":[ {
			"id": 33,
	        "created_at": "2018-10-29 08:14:44",
	        "updated_at": "2018-10-29 08:14:44",
	        "wechat_id": "oMq605Kr5r1-DQPQBtnFraGNQXsw",
	        "price": 222.01, 		//订单总价
	        "status": 0,
	        "remark": null,
	        "info": null,
	        "contact": "liu",
	        "address": "SHENZHEN",
	        "phone": "13800138123",
	        "comment_id": null,
	        "paid_at": null,
	        "comment": null,
	        "products": [
				{
					...(其他字段，忽略)
					"pivot": {
	                        "order_id": 33,
	                        "product_id": 5,
	                        "product_name": "婴儿车",
	                        "product_color": "高端黑",
	                        "product_price": 222,
	                        "product_amount": 1,
	                        "product_photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
	                    }
				}, 
				{
					...(其他字段，忽略)
					"pivot": {
	                        "order_id": 33,
	                        "product_id": 6,
	                        "product_name": "玩具",
	                        "product_color": "王祖蓝",
	                        "product_price": 0.01,
	                        "product_amount": 2,
	                        "product_photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
	                    }
				}
			]
		},
		...
   ]
}
```

## 自定义打赏金额接口
### 修改打赏金额
- `POST /reward/price`
- 参数:

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
price          |  double  | 	必须               |  打赏金额，单位元

### 获得打赏金额
- `GET /reward/price`
- 参数：无
- 响应：

```
{
    "status": 0,
    "data": {
        "price": 0.05
    }
}
```

## 首页底部图片和介绍
### 获得首页底部图片和介绍
- `GET /bottom`
- 参数：无
- 响应：

```
{
    "status": 0,
    "data": {
        "content": "<html>底部副文本</html>",
        "photo": "https://wechat.sotype.com/storage/16359f72-b44a-11e8-96f8-529269fb1459.jpg"
    }
}
```

### 修改首页底部图片和介绍
- `POST /bottom/store`
- 参数:

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
photo          |  string  | 	必须               |  底部图片url
content        |  text   | 	必须               |  底部富文本介绍


## 购物车接口
### 添加到购物车

- `POST /shopcar/add`
- 参数:

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
product_id     |  int    | 	必须               |  产品id
product_amount |  int    | 	可选，默认为1       |  产品数量

- 响应:

```
{
    "status": 0,
    "message": "已加入购物车！"
}
```
```
{
    "status": -1,
    "error": "请输入产品ID"
}
```

### 修改购物车里产品数量

- `POST /shopcar/amount`
- 参数:

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
product_id     |  int    | 	必须               |  产品id
product_amount |  int    | 	必须               |  产品数量

- 响应:

```
{
    "status": 0,
    "message": "修改成功！"
}
```
```
{
    "status": -1,
    "error": "请输入产品ID和数量"
}
```


### 批量添加/修改购物车里产品数量

- `POST /shopcar/pstore`
- 参数:

```
[
  {
    "id": 5,
    "amount": 3
  },
  {
    "id": 6,
    "amount": 4
  },
  {
    "id": 35,
    "amount": 5
  },
  {
    "id": 37,
    "amount": 4
  }
]
```

- 响应:

```
{
    "status": 0,
    "message": "批量修改成功！"
}
```

### 删除购物车里产品

- `DELETE /shopcar/{id}`
- 参数: 无

- 响应:

```
{
    "status": 0,
    "message": "删除成功！"
}
```
```
{
    "status": -1,
    "error": "请输入产品ID"
}
```

### 批量删除购物车里产品

- `DELETE /shopcar/pdelete`
- 参数: 

参数            |  类型    |   可选               |    备注
-----------    |  ------  |  ------------------ |  --------
ids            |  array   | 	必须               |  产品ids,比如[1,2,3,4]

- 响应:

```
{
    "status": 0,
    "message": "批量删除成功！"
}
```
```
{
    "status": -1,
    "error": "请输入产品ID"
}
```

### 购物车列表
- `GET /shopcars`
- 参数： 无
- 响应:

```
{
    "status": 0,
    "data": [
        {
            "id": 1,
            "created_at": "2018-10-29 03:36:39",
            "updated_at": "2018-10-29 09:03:16",
            "product_id": 5,
            "wechat_id": "oMq605Kr5r1-DQPQBtnFraGNQXsw",
            "product_amount": 2,
            "name": "婴儿车",
            "price": 222,
            "classify": "分类2",
            "color": "高端黑",
            "status": 0,
            "photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
        },
        {
            "id": 2,
            "created_at": "2018-10-29 09:03:30",
            "updated_at": "2018-10-29 09:08:42",
            "product_id": 6,
            "wechat_id": "oMq605Kr5r1-DQPQBtnFraGNQXsw",
            "product_amount": 6,
            "name": "玩具",
            "price": 0.01,
            "classify": "分类1",
            "color": "王祖蓝",
            "status": 0,
            "photo": "https://wechat.sotype.com/storage/gOtuHM3GvKva6x68N340DJuN6cX1oIfaAhWi8yoq.jpeg"
        }
    ]
}
```