前端商城接口文档
# 1. 获取某个菜单的子菜单
请求地址:/index/cates/{pid}
请求方式:GET
请求参数:
| 请求参数名 | 参数说明 | 值类型 | 是否必须 |
|---|---|---|---|
| pid | 分类的父id | int | 是 |
正确响应:
{
"code": 0,
"msg": "success",
"data": [
{
"catId": 100,
"name": "文学",
"parentCid": 1,
"catLevel": 2,
"showStatus": 1,
"sort": 0,
"icon": null,
"productUnit": null,
"productCount": 0,
"subs": [
{
"catId": 120,
"name": "小说",
"parentCid": 100,
"catLevel": 1,
"showStatus": 1,
"sort": 0,
"icon": null,
"productUnit": null,
"productCount": 0
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 2. 数据校验
功能说明:
实现用户数据的校验,主要包括对:手机号、用户名的唯一性校验。
接口路径:
GET /ums/user/check/{data}/{type}
1
参数说明:
| 参数 | 说明 | 是否必须 | 数据类型 | 默认值 |
|---|---|---|---|---|
| data | 要校验的数据 | 是 | String | 无 |
| type | 要校验的数据类型:1,用户名;2,手机;3,邮箱 | 是 | Integer | 无 |
返回结果:
返回布尔类型结果:
- true:可用
- false:不可用
# 3. 生成短信验证码
功能说明:
根据用户输入的手机号,生成随机验证码,长度为6位,纯数字。并且调用短信服务,发送验证码到用户手机。
接口路径:
POST /ums/user/code
1
参数说明:
| 参数 | 说明 | 是否必须 | 数据类型 | 默认值 |
|---|---|---|---|---|
| phone | 用户的手机号码 | 是 | String | 无 |
返回结果:
无
# 4. 用户注册
功能说明:
实现用户注册功能,需要对用户密码进行加密存储,使用MD5加密,加密过程中使用随机码作为salt加盐。另外还需要对用户输入的短信验证码进行校验。
接口路径:
POST /ums/user/register
1
参数说明:
form表单格式
| 参数 | 说明 | 是否必须 | 数据类型 | 默认值 |
|---|---|---|---|---|
| username | 用户名,格式为4~30位字母、数字、下划线 | 是 | String | 无 |
| password | 用户密码,格式为4~30位字母、数字、下划线 | 是 | String | 无 |
| mobile | 手机号码 | 是 | String | 无 |
| 邮箱 | 是 | String | 无 | |
| code | 短信验证码 | 是 | String | 无 |
返回结果:
无返回值。
# 5. 根据用户名和密码查询用户
功能说明:
查询功能,根据参数中的用户名和密码查询指定用户
接口路径:
GET /ums/user/query
1
参数说明:
form表单格式
| 参数 | 说明 | 是否必须 | 数据类型 | 默认值 |
|---|---|---|---|---|
| username | 用户名,格式为4~30位字母、数字、下划线 | 是 | String | 无 |
| password | 用户密码,格式为4~30位字母、数字、下划线 | 是 | String | 无 |
返回结果:
用户的json格式数据
编辑 (opens new window)
上次更新: 2024/06/15, 15:12:25