Skip to content

Latest commit

 

History

History
1732 lines (1106 loc) · 64.4 KB

api.md

File metadata and controls

1732 lines (1106 loc) · 64.4 KB

河马先生API接口文档

1、用户模块

1.1、用户注册接口

简要描述
  • 用户注册接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
username string 用户名
--- --- --- ---
password string 密码
email string 邮箱
verCode string 邮箱验证码
verCodeId int 邮箱验证码id
后端接收JSON数据格式
{"username":"zzlzzzxxxyy","password":"z","email":"z","verCode":"300104","verCodeId":7}
后端返回JSON数据格式

1.用户未点击获取验证码直接登录,verCodeId = 0

{"code": 401,"msg": "请获取验证码后再进行登录","data": {}}

2.用户未验证码过期(超过5分钟)

{"code": 402,"msg": "验证码过期,请重新获取验证码","data": {}}

3.用户输入验证码错误

{"code": 403,"msg": "验证码错误,请重新输入验证码","data": {}}

4.用户名已存在

{"code": 409,"msg": "用户名已存在","data": {}}

5.用户注册成功 { "code": 200, "msg": "注册成功", "data": {} }

返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

1.2、用户登录接口

简要描述
  • 用户登录接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
username string 用户名
--- --- --- ---
password string 密码
返回示例
{"code": 200,"data": {"id":"123""username": "12154545","token": "xxx.yyy.zzz"},"msg": "用户登录成功"}
{"code": 401,"data": {"username": "12154545"},"msg": "用户名或密码错误"}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data 参数名 类型 说明
id long 用户id
--- --- ---
usename string 用户名
token string token令牌

1.3、用户主页接口

简要描述
  • 用户主页接口
请求URL
请求方式
  • POST
请求头(header)
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
返回示例
{"code": 200,"msg": "用户信息返回成功","data": {"receiver": [{"id": 33,"userId": 30,"name": "1","phone": "1","province": "1","city": "1","district": "1","address": "1","createTime": "2021-07-24 06:50:10","updateTime": "2021-07-24 06:50:10"},{"id": 12,"userId": 30,"name": "胡图图","phone": "1234567","province": "","city": "菏泽","district": "曹县","address": "翻斗乐园","createTime": "2021-07-19 13:51:20","updateTime": "2021-07-19 13:51:20"}],"user": {"id": 30,"username": "河马先生","email": "[email protected]","phone": "18293635616","avatar": "http://47.106.193.0:8080/upload/2021/07/23/c66d1d2172c740f2bfcf0d762348da03.png","gender": "男","age": 19,"foodPreference": "新鲜水果","signature": "我爱吃!","hometown": "甘肃省","residentArea": "东南大学九龙湖校区","label": "喜欢清淡食物","createTime": "2021-07-02 12:05:24"}}}
备注

收件人信息按照降序排序

{"code": 404,"data": {"username": "12154545"},"msg": "用户名不存在"}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data 参数名 类型 说明
id Long 用户id
--- --- ---
usename string 用户名
email string 用户邮箱
avatar string 用户头像
receiver Obiect 收货人信息

| | | |

receiver** 参数名 ** ** 类型 ** ** 说明**
id Long 收件人信息id
--- --- ---
userId Long 用户id
name string 收货人姓名
phone string 收货人电话
province string 收货人省份
city string 收货人城市
district string 收货人县/区
address string 收货人详细地址
createTime yyyy-MM-dd HH:mm:ss 收件人信息创建时间
updateTime yyyy-MM-dd HH:mm:ss 收件人信息更新时间
备注

error_code: 用户消息成功返回:200 用户消息返回失败:404

1.4、修改密码接口

简要描述
  • 修改密码接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
oldPassword string 用户原始密码
newPassword string 用户新密码
后端接收JSON格式数据示例
{"oldPassword":"xxxxxx","newPassword":"yyyyyy"}
后端返回JSON格式数据示例
{"code": 200,"msg": "用户密码修改成功","data": {}}
{"code": 404,"msg": "用户密码修改失败","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

1.5、修改个人资料接口

简要描述
  • 修改个人资料接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
username string 用户名
email string 用户邮箱
phone string 用户手机号
后端接收JSON格式数据示例

| {"email":"[email protected]","phone":"13344445555","gender":"男","age":20,"foodPreference":"热带水果","signature":"我爱吃吃吃!!!","hometown":"甘肃省","residentArea":"江苏省南京市东南大学九龙湖校区","label":"666"

}
后端返回JSON格式数据示例
{"code": 200,"msg": "用户个人信息修改成功","data": {}}
{"code": 404,"msg": "用户名已存在","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

1.6、发送邮箱验证码接口

简要描述
  • 发送邮箱验证码接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
email string 注册者邮箱
--- --- --- ---
后端接收JSON数据格式
{"email":"[email protected]"}
后端返回JSON数据格式
{"code": 200,"msg": "验证码发送成功","data": {"verCodeId": 5}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data类 数据属性说明
参数名 类型 说明
verCodeId string 验证码id
--- --- ---

1.7、获取用户评论接口

简要描述
  • 商品列表显示接口
请求URL
请求方式
  • POST
后端返回JSON数据格式
参数名 类型 说明
id int 评论id
--- --- ---
comment string 评论
userid Long 用户id
username String 用户名
userAvatar String 用户头像
productId Long 商品id
productName String 商品名
productUrl String 商品图片url
score double 商品评分
createTime yyyy-MM-dd HH:mm:ss 评论创建时间
返回示例
{"code": 200,"msg": "查找成功","data": [{"id": 1,"comment": "good","userId": 1,"username": "123","userAvatar": "666","productId": 1,"productName": "123","productUrl": "123","score": 3.5,"createTime": "2021-07-21 07:38:48"},{"id": 3,"comment": "ccc","userId": 2,"username": "uname2","userAvatar": null,"productId": 1,"productName": "name1","productUrl": "url1","score": 3.5,"createTime": "2021-07-21 06:58:49"},{"id": 4,"comment": "good","userId": 1,"username": "123","userAvatar": "666","productId": 1,"productName": "123","productUrl": "123","score": 3.5,"createTime": "2021-07-21 07:54:03"}]}
{"code": 404,"msg": 找不到相关评论"data": null}
备注

error_code: 成功:200 找不到相关商品:404

2、商品模块

2.1、商品搜索接口

简要描述
  • 商品列表显示接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
page int 页数
--- --- --- ---
page-num int 每页商品个数
product-name string 商品名
category_id int 商品类型 (默认全部)
sort int 排序依据 (默认销量)
order int 排序方式(默认按降序)
upper-bound int 价格上界
lower-bound int 价格下界

备注: page: 默认为0 page-num: 默认为10 type: 0:全部(默认), 1:蔬菜, 2:水果, 3:肉类 sort: 0.匹配权重排序(默认) 1:销量排序, 2:价格 3.评分 order: 1.降序(默认), 2.升序 (上下界可以指定其一,也可以都指定)

json参数
参数名 类型 说明
id int 索引id
--- --- ---
name string 商品名
picture char(url) 商品图片
price double 商品价格
sales_amount int 商品销量
pictureUrl String 商品图片url
score double 商品评分
searchHit int 查找到的个数
maxPrice double 最大价格
minPrice double 最小价格
返回示例
{"code": 200,"msg": "查找成功","data": [[{"id": "27305","productId": 27305,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "【佳农贴近百姓的水果量贩】吃香蕉认准佳农品牌,香甜软糯,口感出色的进口香蕉【更多优惠,戳这里】","price": 29.9,"detail": null,"salesAmount": 77,"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/6470/27/3945/118495/5bdac42aE04b61c95/5c6e65a37691c602.jpg","status": 1,"score": null},{"id": "27350","productId": 27350,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "都乐Dole 菲律宾进口香蕉 超甜蕉1把装 净重700g 生鲜水果 健康轻食","price": 19.9,"detail": null,"salesAmount": 52,"pictureUrl": "http://img10.360buyimg.com/n1/jfs/t1/163845/3/808/92646/5ff29094Ee2667b38/dbf4ab18eb6b3bb6.jpg","status": 1,"score": null},{"id": "27725","productId": 27725,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "都乐Dole 进口大把蕉 香蕉1kg装 生鲜水果 健康轻食","price": 19.9,"detail": null,"salesAmount": 65,"pictureUrl": "http://img12.360buyimg.com/n1/jfs/t1/123701/17/1023/341439/5eb90fcdE3f23148f/510cf1b65e1f4f51.jpg","status": 1,"score": null},{"id": "27850","productId": 27850,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "黄元帅苹果 5斤装 香蕉金帅粉面水果新鲜当季整箱香甜刮泥 黄元帅 5斤 精品大果 75-85mm","price": 32.99,"detail": null,"salesAmount": 23,"pictureUrl": "http://img10.360buyimg.com/n1/jfs/t1/143727/37/19025/55463/5fddb5fcE3d9301c1/3febf2c77d016b3e.jpg","status": 1,"score": null},{"id": "27901","productId": 27901,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "小米蕉 香蕉 广西小米蕉自然熟糯米蕉香蕉新鲜5斤当季水果大芭蕉皇帝蕉新鲜水果","price": 13.9,"detail": null,"salesAmount": 92,"pictureUrl": "http://img13.360buyimg.com/n1/jfs/t1/182469/36/10824/73037/60d2b5dbE018c04bc/86adc3988a4b34bd.jpg","status": 1,"score": null},{"id": "28214","productId": 28214,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "贵州安龙小米蕉 糯米蕉 西贡蕉 新鲜香蕉 坏果包赔 带箱3斤","price": 11.9,"detail": null,"salesAmount": 50,"pictureUrl": "http://img12.360buyimg.com/n1/jfs/t1/157205/40/5859/82607/6016d1e0Eb31da396/28e5f6f88aa7ddd5.jpg","status": 1,"score": null},{"id": "28355","productId": 28355,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "香蕉很小,8厘米左右长,生果发货,收到催熟!","price": 11.8,"detail": null,"salesAmount": 83,"pictureUrl": "http://img12.360buyimg.com/n1/jfs/t1/113805/11/12169/74904/5f08b4f4E7dee55b4/62f6ebdf7ba2444e.jpg","status": 1,"score": null},{"id": "28983","productId": 28983,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "自然熟糯米蕉香蕉新鲜5斤当季水果大芭蕉皇帝蕉整箱批发","price": 14.9,"detail": null,"salesAmount": 85,"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/87109/24/16347/152463/5e79b4bfE37856883/2220b0f08d38777f.jpg","status": 1,"score": null},{"id": "28991","productId": 28991,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "菓红蔬青 贵州安龙新鲜香蕉糯米蕉 整箱10斤装 净重约9斤","price": 57.9,"detail": null,"salesAmount": 100,"pictureUrl": "http://img13.360buyimg.com/n1/jfs/t1/159545/24/3547/82603/60028d4aEf9dd98d3/f174f6aa7c028434.jpg","status": 1,"score": null},{"id": "29120","productId": 29120,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "淳果一木 小米蕉 10斤 香蕉苹果蕉芭蕉 自然熟糯米蕉芭蕉 青皮发货 新鲜水果 10斤带箱(净重9斤)","price": 17.8,"detail": null,"salesAmount": 30,"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/185773/4/13065/109101/60e69d3aE0f686130/ba2bea20389dfdb5.jpg","status": 1,"score": null}],{"searchHit": 47,"minPrice": 11.8,"maxPrice": 489.0}]}
{"code": 404,"msg": 找不到相关商品"data": null}
备注

error_code: 成功:200 找不到相关商品:404

2.2、单个商品显示接口

简要描述
  • 单个商品显示接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
id Long 商品id
--- --- --- ---
返回示例
{"code": 200,"msg": "商品信息查询成功","data": {"originPlace": null,"categorySecond": "水果","pictureUrlOne": "http://img12.360buyimg.com/n1/jfs/t1/43985/2/9352/576355/5d2f00f4E720cec12/6f416d61d8e7e34c.jpg","pictureUrlTwo": "http://img12.360buyimg.com/n1/jfs/t1/122917/18/2522/178597/5ec64077Ea66bfd44/2b506099734da405.jpg","pictureUrlThree": "http://img12.360buyimg.com/n1/jfs/t1/64467/34/4838/130320/5d2f00f3Eb4692b8b/eea4d686355a4736.jpg","pictureUrlFour": "http://img12.360buyimg.com/n1/jfs/t1/62822/36/4726/126640/5d2f00f1Ef1a92421/a2a61f36076a2533.jpg","salesAmount": 40,"price": 19.8,"name": "甜果源 新鲜桃子 净重5斤装 水蜜桃 脆甜毛桃子 新鲜水果 5斤转","id": 29351,"detail": null,"stock": 999,"score": 3.5,"categoryFirst": "新鲜水果","status": 1}}
{"code": 404,"msg": "找不到相关商品","data": {"id": 33}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
id long 查找商品id
data参数说明
参数名 类型 说明
id Long 商品id
--- --- ---
name string 商品名
pictureUrl string 商品图片地址
price double 商品单价
stock Long 商品库存
detail string 商品描述
originPlace string 商品产地
status Integer 商品状态
salesAmount Long 商品销量
score double 商品评分

product status(商品状态): 1-在售 2-下架

备注

error_code: 成功:200 找不到相关商品:404

2.3、推荐商品列表显示接口

简要描述
  • 推荐商品列表显示接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
page int 页数
--- --- --- ---
page-num int 每页商品个数
product-name string 主商品名

备注: page: 默认为0 page-num: 默认为10 type: 0:全部(默认), 1:蔬菜, 2:水果, 3:肉类

json参数
参数名 类型 说明
id int 商品id
--- --- ---
name string 商品名
picture char(url) 商品图片
price double 商品价格
sales_amount int 商品销量
pictureUrl String 商品图片url
score double 商品评分
searchHit int 查找到的个数
maxPrice double 最大价格
minPrice double 最小价格
返回示例
{"code": 200,"msg": "查找成功","data": [[{"id": "27305","productId": 27305,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "【佳农贴近百姓的水果量贩】吃香蕉认准佳农品牌,香甜软糯,口感出色的进口香蕉【更多优惠,戳这里】","price": 29.9,"detail": null,"salesAmount": 77,"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/6470/27/3945/118495/5bdac42aE04b61c95/5c6e65a37691c602.jpg","status": 1,"score": null},{"id": "27350","productId": 27350,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "都乐Dole 菲律宾进口香蕉 超甜蕉1把装 净重700g 生鲜水果 健康轻食","price": 19.9,"detail": null,"salesAmount": 52,"pictureUrl": "http://img10.360buyimg.com/n1/jfs/t1/163845/3/808/92646/5ff29094Ee2667b38/dbf4ab18eb6b3bb6.jpg","status": 1,"score": null},{"id": "27725","productId": 27725,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "都乐Dole 进口大把蕉 香蕉1kg装 生鲜水果 健康轻食","price": 19.9,"detail": null,"salesAmount": 65,"pictureUrl": "http://img12.360buyimg.com/n1/jfs/t1/123701/17/1023/341439/5eb90fcdE3f23148f/510cf1b65e1f4f51.jpg","status": 1,"score": null},{"id": "27850","productId": 27850,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "黄元帅苹果 5斤装 香蕉金帅粉面水果新鲜当季整箱香甜刮泥 黄元帅 5斤 精品大果 75-85mm","price": 32.99,"detail": null,"salesAmount": 23,"pictureUrl": "http://img10.360buyimg.com/n1/jfs/t1/143727/37/19025/55463/5fddb5fcE3d9301c1/3febf2c77d016b3e.jpg","status": 1,"score": null},{"id": "27901","productId": 27901,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "小米蕉 香蕉 广西小米蕉自然熟糯米蕉香蕉新鲜5斤当季水果大芭蕉皇帝蕉新鲜水果","price": 13.9,"detail": null,"salesAmount": 92,"pictureUrl": "http://img13.360buyimg.com/n1/jfs/t1/182469/36/10824/73037/60d2b5dbE018c04bc/86adc3988a4b34bd.jpg","status": 1,"score": null},{"id": "28214","productId": 28214,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "贵州安龙小米蕉 糯米蕉 西贡蕉 新鲜香蕉 坏果包赔 带箱3斤","price": 11.9,"detail": null,"salesAmount": 50,"pictureUrl": "http://img12.360buyimg.com/n1/jfs/t1/157205/40/5859/82607/6016d1e0Eb31da396/28e5f6f88aa7ddd5.jpg","status": 1,"score": null},{"id": "28355","productId": 28355,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "香蕉很小,8厘米左右长,生果发货,收到催熟!","price": 11.8,"detail": null,"salesAmount": 83,"pictureUrl": "http://img12.360buyimg.com/n1/jfs/t1/113805/11/12169/74904/5f08b4f4E7dee55b4/62f6ebdf7ba2444e.jpg","status": 1,"score": null},{"id": "28983","productId": 28983,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "自然熟糯米蕉香蕉新鲜5斤当季水果大芭蕉皇帝蕉整箱批发","price": 14.9,"detail": null,"salesAmount": 85,"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/87109/24/16347/152463/5e79b4bfE37856883/2220b0f08d38777f.jpg","status": 1,"score": null},{"id": "28991","productId": 28991,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "菓红蔬青 贵州安龙新鲜香蕉糯米蕉 整箱10斤装 净重约9斤","price": 57.9,"detail": null,"salesAmount": 100,"pictureUrl": "http://img13.360buyimg.com/n1/jfs/t1/159545/24/3547/82603/60028d4aEf9dd98d3/f174f6aa7c028434.jpg","status": 1,"score": null},{"id": "29120","productId": 29120,"categoryFirst": "新鲜水果","categorySecond": "水果","name": "淳果一木 小米蕉 10斤 香蕉苹果蕉芭蕉 自然熟糯米蕉芭蕉 青皮发货 新鲜水果 10斤带箱(净重9斤)","price": 17.8,"detail": null,"salesAmount": 30,"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/185773/4/13065/109101/60e69d3aE0f686130/ba2bea20389dfdb5.jpg","status": 1,"score": null}],{"searchHit": 47,"minPrice": 11.8,"maxPrice": 489.0}]}
{"code": 404,"msg": 找不到相关商品}

2.4、根据商品id数组显示商品信息接口

简要描述
  • 根据商品id数组显示商品信息接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
ids List 商品ids
--- --- --- ---
后端接收JSON数据示例
{"ids":[1,2,3]}
后端返回JSON数据示例

成功(ids列表商品均存在)

{"code": 200,"msg": "商品查找成功","data": {"products": [{"price": 20.0,"pictureUrl": "http://xxxx","name": "茄子","score": 3.5,"details": "好吃"},{"price": 2.0,"pictureUrl": "http://xxxx","name": "苹果","details": "曹县大苹果,香啊!!!!!"},{"price": 2.5,"pictureUrl": "http://kkk","name": "葡萄","score": 3.5,"details": "果大肉多的美味葡萄!!!"}]}}

失败(ids列表商品不存在 或 ids列表为空)

{"code": 404,"msg": "商品查找失败","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data参数说明
参数名 类型 说明
name string 商品名
--- --- ---
pictureUrl string 商品图片地址
price double 商品单价
details string 商品详情
score double 商品评分

2.5、商品列表显示接口

简要描述
  • 商品列表显示接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
page int 页数
--- --- --- ---
pageNum int 每页商品个数
categoryFirst int 商品类型-第一级
categorySecond int 商品类型-第二级

备注: page: 默认为0 page-num: 默认为6

json参数
参数名 类型 说明
id int 商品id
--- --- ---
name string 商品名
price double 商品价格
sales_amount int 商品销量
score double 商品评分
pictureUrl String 商品图片url
返回示例
{"code": 200,"msg": "查找成功","data": [{"id": "7","productId": 10,"name": "苹果1","price": 123.0,"salesAmount": 5,"score": 3.5,"pictureUrl":"example.Url"},{"id": "6","productId": 9,"name": "苹果2","price": 123.0,"salesAmount": 4,"score": 3.5,"pictureUrl":"example.Url"},{"id": "4","productId": 7,"name": "苹果富士康","price": 123.0,"salesAmount": 2,"score": 3.5,"pictureUrl":"example.Url"},{"id": "3","productId": 6,"name": "富士康苹果","price": 123.0,"salesAmount": 1,"score": 3.5,"pictureUrl":"example.Url"}]}
{"code": 404,"msg": 找不到相关商品"data": null}
备注

error_code: 成功:200 找不到相关商品:404

2.6、获取商品评论接口

简要描述
  • 获取商品评论接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
productId Long 商品id
--- --- --- ---
json参数
参数名 类型 说明
id int 评论id
--- --- ---
comment string 评论
userid Long 用户id
username String 用户名
userAvatar String 用户头像
productId Long 商品id
productName String 商品名
productUrl String 商品图片url
score double 商品评分
createTime yyyy-MM-dd HH:mm:ss 评论创建时间
返回示例
{"code": 200,"msg": "查找成功","data": [{"id": 1,"comment": "good","userId": 1,"username": "123","userAvatar": "666","productId": 1,"productName": "123","productUrl": "123","score": 3.5,"createTime": "2021-07-21 07:38:48"},{"id": 3,"comment": "ccc","userId": 2,"username": "uname2","userAvatar": null,"productId": 1,"productName": "name1","productUrl": "url1","score": 3.5,"createTime": "2021-07-21 06:58:49"},{"id": 4,"comment": "good","userId": 1,"username": "123","userAvatar": "666","productId": 1,"productName": "123","productUrl": "123","score": 3.5,"createTime": "2021-07-21 07:54:03"}]}
{"code": 404,"msg": 找不到相关评论"data": null}
备注

error_code: 成功:200 找不到相关商品:404

写商品评论接口

简要描述
  • 写商品评论接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
comment string 评论
--- --- --- ---
productId Long 商品id
star int 商品评分

score默认为5, score范围1,2,3,4,5

返回示例
{"code": 200,"msg": "保存评论成功","data": null}
{"code": 500,"msg": 服务器内部错误"data": null}

2.8、搜索商品建议接口

简要描述
  • 搜索商品建议接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
search String 搜索语句
--- --- --- ---
json参数

直接在data中返回搜索建议

返回示例
{"code": 200,"msg": "查找建议成功","data": ["香瓜","香蕉","百香果","香椿","香菜","茴香","芜荽(大叶香菜","小叶香菜)","香椿芽","香菇"]}
{"code": 404,"msg": "找不到相关建议","data": {"search": "xiangd"}}
备注

error_code: 成功:200 找不到相关建议:404

2.9、首页商品秒杀列表接口

简要描述
  • 首页商品秒杀列表接口
请求URL
请求方式
  • POST
json参数
参数名 类型 说明
id int 商品id
--- --- ---
name string 商品名
originPrice double 商品原价
currentPrice double 商品现价
pictureUrl String 商品图片url
time String 秒杀时间
stock int 商品库存
返回示例
{"code": 200,"msg": "查找秒杀商品成功","data": [{"pictureUrl": "http://img13.360buyimg.com/n1/jfs/t1/111185/10/1129/287838/5e954fb0E9e54edf1/e278565253cb598e.jpg","name": "一整只酱板鸭,甄选散养【老麻鸭】,非速成鸭,肉质紧实,有嚼劲","currentPrice": 11.639999999999999,"id": 109770,"originPrice": 38.8,"time": "2021-07-30 20:00:00","stock": 999},{"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/195852/37/250/113890/6088cea6Ea9a0441e/4b3e6eda1cb3d80f.jpg","name": "【富含维C的超级水果】源自新西兰的12粒特大果王,超级性价比实惠包装,甜蜜多汁圆润饱满,综合营养纵享健康【免费开卡享会员福利】","currentPrice": 47.699999999999996,"id": 108196,"originPrice": 159.0,"time": "2021-07-30 20:00:00","stock": 999},{"pictureUrl": "http://img14.360buyimg.com/n1/jfs/t1/176124/33/1797/131814/60680b08Eab0cd50d/fcc2a95f9daaa9e1.jpg","name": "新鲜粽叶竹叶包粽子的大粽子叶大叶真空包装棕叶子50片批发 精品大粽叶10cm以上 50片粽绳","currentPrice": 4.08,"id": 165775,"originPrice": 13.6,"time": "2021-07-30 20:00:00","stock": 999},{"pictureUrl": "http://img11.360buyimg.com/n1/jfs/t1/196158/18/9425/146836/60cfe292Efb34a09a/4cd4b494e05c897c.jpg","name": "必品阁bibigo韩式王饺子组合蒸饺煎饺速冻早餐希杰 白菜1菌菇1玉米1泡菜1+煎饺250g","currentPrice": 65.97,"id": 161655,"originPrice": 219.9,"time": "2021-07-30 20:00:00","stock": 999}]}

3、购物车模块

3.1、购物车增加商品接口

简要描述
  • 购物车增加商品接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
username string 用户名
--- --- --- ---
product_name string 商品名称
返回示例
{"code": 200,"msg": 商品添加成功"data": {"product_name": "菠萝","quantity": "20","stock": "1000"}}
{"code": 404,"msg": 商品添加失败"data": {"product_name": "菠萝","quantity": "20","stock": "1000"}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data 参数名 类型 说明
product_name string 购物车中添加商品名称
--- --- ---
quantity int 购物车中该商品数量
stock int 商品库存
备注

error_code: 商品添加成功:200 商品添加失败:404

3.2、购物车删除商品接口

简要描述
  • 购物车删除商品接口
请求URL
请求方式
  • DELETE
参数
参数名 必选 类型 说明
username string 用户名
--- --- --- ---
product_name string 商品名称
返回示例
{"code": 200,"msg": 商品删除成功"data": {"product_name": "菠萝",}}
{"code": 404,"msg": 商品删除失败"data": {"product_name": "菠萝",}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data 参数名 类型 说明
product_name string 购物车中被删除商品名称
--- --- ---
备注

error_code: 商品删除成功:200 商品删除失败:404

3.3、购物车更新商品接口

简要描述
  • 购物车更新商品接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
product数组
后端接收JSON数据示例
{"products":[{"id": 1,"quantity": 111},{"id": 2,"quantity": 222},{"id": 3,"quantity": 333}]}
返回示例
{"code": 200,"msg": "购物车更新成功","data": {}}
{"code": 404,"msg": "购物车更新失败""data": {}}}
返回参数说明
参数名 类型 说明
code int 全局错误码
--- --- ---
msg string 请求消息提示
备注

3.4、购物车查找商品接口

简要描述
  • 购物车商品查找商品接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
后端返回JSON数据示例
{"code": 200,"msg": "购物车商品信息查询成功","data": {"products": [{"productQuantity": 2,"productId": 2,"productPicture": "2","currentPrice": 2.0,"productStatus": 1,"OldPrice": 2.0,"productName": "2"},{"productQuantity": 2,"productId": 1,"productPicture": "1","currentPrice": 30.0,"productStatus": 2,"OldPrice": 17.9,"productName": "1"}]}}
{"code": 404,"msg": 购物车商品查询失败"data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data 参数名 类型 说明
id string 商品id
--- --- ---
quantity int 商品数量
postman测试结果

4、订单模块

4.1、删除订单接口

简要描述
  • 删除订单接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
orderId int 订单id
后端接收JSON参数
{"orderId": 2,}
返回示例
{"code": 200,"msg": 订单删除成功,"data":{}}
{"code": 400,"msg": 订单删除失败,"data":{}}

4.2、订单支付接口

简要描述
  • 订单支付接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
orderId int 订单id
receiverId int 收件人id
PaymentType string 支付方式
后端接收JSON格式数据
{"orderId":101,"receiverId":12,"PaymentType":"支付宝"}
后端返回JSON格式数据
支付宝官方html页面

4.3、获取单个订单信息接口

简要描述
  • 获取单个订单信息接口
请求URL
请求方式
  • POST
参数
参数名 类型 说明
token string token令牌
--- --- ---
orderId int 订单号Id
后端接收JSON数据示例
{"orderId":1}
后端返回JSON数据示例
{"code": 200,"msg": "订单信息获取成功","data": {"receiver": [{"address": "东南大学九龙湖校区","name": "闫志豪","phone": "13344445555","id": 1},{"phone": "1111","address": "玄武湖","id": 2,"name": "yzh"}],"orderItem": [{"price": 1.0,"pictureUrl": "xxx","name": "葡萄","quantity":1,"details": "1"},{"price": 1.0,"pictureUrl": "xxx","quantity":22,"name": "苹果","details": "1"}],"orderId":1,"orderStatus": 1,"orderPaymentMoney": 0.0}}
{"code": 404,"msg": "订单信息获取失败","data":{}}

4.4、订单创建接口

简要描述
  • 订单创建接口
请求URL
请求方式
  • POST
请求头header参数
参数名 类型 说明
token string token令牌
--- --- ---
后端接收Json数据示例
{"products":[{"id": 1,"quantity": 20},{"id": 2,"quantity": 203},{"id": 3,"quantity": 333}]}
后端返回Json数据示例
{"code": 200,"msg": "订单创建成功","data": {}}
{"code": 404,"msg": "订单创建成功""data": {}}

4.5、订单号列表获取接口

简要描述
  • 订单号列表获取接口
请求URL
请求方式
  • GET
请求头header参数
参数名 类型 说明
token string token令牌
--- --- ---
后端返回Json数据示例
{"code": 200,"msg": "订单号列表获取成功","data": {"orderIds": [1,2,3,4,5,6,7,8,9,10]}}

4.6、获取全部订单信息接口

简要描述
  • 获取全部订单信息接口
请求URL
请求方式
  • POST
参数
参数名 类型 说明
token string token令牌
--- --- ---
后端返回JSON数据示例
{"code": 200,"msg": "订单信息获取成功","data": {"orders": [{"orderItem": [{"quantity": 6,"price": 65.6,"pictureUrl": "https://img14.360buyimg.com/n7/jfs/t1/156497/38/14593/52789/60478313E6c0926d6/97a388f0af12d53e.jpg","name": "东北茄子","details": null},{"quantity": 3,"price": 78.8,"pictureUrl": "https://img11.360buyimg.com/n7/jfs/t1/103684/30/14119/346433/5e5f7997Eff54bc87/d4fa38c109699a88.jpg","name": "烟台红富士苹果","details": null},{"quantity": 3,"price": 29.9,"pictureUrl": "https://img11.360buyimg.com/n7/jfs/t1/173391/37/10778/538114/60a6fef7Eee07344d/43e20b4eb8ea58b9.jpg","name": "葡萄","details": null},{"quantity": 3,"price": 23.8,"pictureUrl": "https://img13.360buyimg.com/n7/jfs/t1/179183/3/14195/313290/60f0008eE25993789/d6e6b276ebebd5ae.jpg","name": "火龙果","details": null}],"orderId": 86,"orderStatus": 1,"orderPaymentMoney": 791.1},{"orderItem": [{"quantity": 2,"price": 29.9,"pictureUrl": "https://img11.360buyimg.com/n7/jfs/t1/173391/37/10778/538114/60a6fef7Eee07344d/43e20b4eb8ea58b9.jpg","name": "葡萄","details": null},{"quantity": 2,"price": 78.8,"pictureUrl": "https://img11.360buyimg.com/n7/jfs/t1/103684/30/14119/346433/5e5f7997Eff54bc87/d4fa38c109699a88.jpg","name": "烟台红富士苹果","details": null},{"quantity": 1,"price": 65.6,"pictureUrl": "https://img14.360buyimg.com/n7/jfs/t1/156497/38/14593/52789/60478313E6c0926d6/97a388f0af12d53e.jpg","name": "东北茄子","details": null}],"orderId": 87,"orderStatus": 1,"orderPaymentMoney": 283.0}]}}
{"code": 404,"msg": "订单信息获取失败","data":{}}

4.7、订单目录数量获取接口

简要描述
  • 订单目录数量获取接口
请求URL
请求方式
  • POST
参数
参数名 类型 说明
token string token令牌
--- --- ---
后端返回JSON数据示例
{"code": 200,"msg": "用户订单商品目录数量统计成功","data": {"categoryFirst": {"冷冻即食": 0,"海鲜水产": 0,"新鲜水果": 3,"精选肉类": 0,"蔬菜蛋品": 0},"categorySecond": {"牛肉": 0,"蛋类": 0,"热带水果": 2,"面点": 0,"火锅丸料": 0,"热销水果": 2,"鲜菌菇": 0,"猪肉": 0,"内脏类": 0,"烘焙食材": 0,"茄果瓜类": 0,"葱姜蒜椒": 0,"时令水果": 0,"鸡肉": 0,"叶菜类": 0,"海参": 0,"鱼类": 0,"虾类": 0,"贝类": 0,"鸭肉": 0,"羊肉": 0,"根茎类": 0,"蟹类": 0,"饮品甜品": 0,"方便速食": 0}}}

4.8、订单总金额获取接口

简要描述
  • 订单总金额获取接口
请求URL
请求方式
  • POST
参数
参数名 类型 说明
token string token令牌
--- --- ---
后端返回JSON数据示例
{"code": 200,"msg": "订单总金额信息获取成功","data": {"已支付": 87.6,"待支付": 9.99}}

4.9、订单时间段获取接口

简要描述
  • 订单时间段获取接口
请求URL
请求方式
  • POST
参数
参数名 类型 说明
token string token令牌
--- --- ---
后端返回JSON数据示例
{"code": 200,"msg": "订单时间段获取成功","data": {"time": {"00": 0,"11": 0,"22": 1,"01": 2,"12": 0,"23": 1,"02": 0,"13": 0,"03": 0,"14": 0,"04": 0,"15": 0,"05": 0,"16": 0,"06": 0,"17": 0,"07": 0,"18": 0,"08": 0,"19": 0,"09": 0,"20": 0,"10": 0,"21": 0}}}

5、收件人模块

5.1、增加收件人接口

简要描述
  • 增加收件人接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
name string 收件人姓名
phone string 收件人电话
province string 收件人省份
city string 收件人城市
district string 收件人县/区
address string 收件人详细地址
后端接收JSON格式数据示例
{"name":"xxx","phone":"13344445555","province":"江苏省","city":"南京市","district":"江宁区","address":"江苏省南京市江宁区东南大学路2号"}
后端返回JSON格式数据示例
{"code": 200,"msg": "收件人添加成功","data": {"address": "江苏省南京市江宁区东南大学路2号","province": "江苏省","phone": "13344445555","city": "南京市","district": "江宁区","name": "xxx","id": 4}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data** 参数名 ** ** 必选 ** ** 类型 ** ** 说明**
id int 收件人id
--- --- --- ---
name string 收件人姓名
phone string 收件人电话
province string 收件人省份
city string 收件人城市
district string 收件人县/区
address string 收件人详细地址

5.2、删除收件人接口

简要描述
  • 删除收件人接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
receiverId int 收件人id
后端接收JSON格式数据示例
{"receiverId":"6"}
后端返回JSON格式数据示例
{"code": 200,"msg": "收件人删除成功","data": {}}
{"code": 404,"msg": "收件人删除失败","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

6、文件上传模块

6.1、文件上传接口

简要描述
  • 文件上传接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
file MultipartFile 文件
--- --- --- ---
返回示例
{"code": 200,"msg": "文件上传成功""data": {"url": "http://xxxxxx"}}
{"code": 404,"msg": "文件上传失败""data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示
data类 数据属性说明
参数名 类型 说明
url string 可访问该文件地址
--- --- ---

7、收藏夹模块

7.1、收藏夹添加商品接口

简要描述
  • 收藏夹添加商品接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
productId int 商品id
后端接收JSON数据格式
{"productId":8536}
后端返回JSON数据格式
{"code": 200,"msg": "收藏夹添加商品成功","data": {}}

错误一:该商品不存在

{"code": 404,"msg": "收藏夹添加商品不存在","data": {}}

错误二:用户已收藏该商品

{"code": 405,"msg": "你已收藏该商品","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

7.2、收藏夹删除商品接口

简要描述
  • 收藏夹删除商品接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
productId int 商品id
后端接收JSON数据格式
{"productId":8536}
后端返回JSON数据格式
{"code": 200,"msg": "收藏夹删除商品成功","data": {}}

该用户收藏夹中不存在该商品

{"code": 404,"msg": "收藏夹删除商品失败","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

7.3、收藏夹商品查找接口

简要描述
  • 收藏夹商品查找接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
后端返回JSON数据格式
{"code": 200,"msg": "收藏夹查找成功","data": {"products": [{"productId": 8542,"productPicture": "http://img10.360buyimg.com/n7/jfs/t1/167568/20/21240/127498/6088cc9fE31988e11/eecfe59b7d20139b.jpg","productStatus": 1,"productName": "【精美定制礼盒】佳沛新西兰产季包装精美的水果礼盒,国际大牌Zespri佳沛出品,沐浴纯净阳光【免费开卡享会员福利】","oldPrice": 109.0,"currentPrice": 30},{"productId": 8541,"productPicture": "http://img11.360buyimg.com/n7/jfs/t1/167493/14/12148/97249/604b1bf6E40ea4c95/ba5d6001257d3f44.jpg","productStatus": 1,"productName": "【产地直采】【百万好评】爆款烟台红富士,清脆酸甜!","oldPrice": 38.8"currentPrice": 30}]}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

8、用户通知模块

8.1、获取用户通知接口

简要描述
  • 获取用户通知接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
后端返回JSON数据示例
{"code": 200,"msg": "用户通知获取成功","data": {"messageId": 43,"productId": 108180,"productName":"香蕉","oldPrice": 89.0,"currentPrice": 50.99,"percentage": 0.43,"productPicture": "http://img11.360buyimg.com/n1/jfs/t1/164269/26/11561/175674/604861acE512bf3c9/169cf1fb33a875d8.jpg","message": "尊敬的用户你好: 你收藏的商品: 低卡轻食,618狂欢!食力好物满199减100元,爆品,低至5折!速来!查看(此商品不参加上述活动) 加入收藏夹以来降价幅度超过30%,快来关注一下吧!!","createTime": "2021-07-27 15:41:57"}}
{"code": 201,"msg": "用户暂无通知","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

8.2、更改消息状态接口

简要描述
  • 更改消息状态接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token string token令牌
--- --- --- ---
后端接收JSON数据示例
{"messageId":20}
后端返回JSON数据示例
{"code": 200,"msg": "用户通知阅读状态修改成功","data": {"messageId": 20}}
{"code": 200,"msg": "用户通知阅读状态修改失败","data": {"messageId": 20}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

9、论坛模块

9.1、发帖接口

简要描述
  • 发帖接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
token String token令牌
--- --- --- ---
title String 帖子标题
content String 帖子内容
后端接收JSON格式数据
{"title":"标题","content":"内容"}
后端返回JSON格式数据
{"code": 200,"msg": "发帖成功","data": {}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

9.2、查询论坛接口

简要描述
  • 查询论坛接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
pageIndex int 当前查询页码(从0开始)
--- --- --- ---
pageSize int 每页大小
后端接收JSON格式数据
{"pageIndex":0,"pageSize":3}
后端返回JSON格式数据
{"code": 200,"msg": "论坛获取成功","data": {"forum": [{"id": 7,"userId": 30,"username": "河马先生","userAvatar": "http://47.106.193.0:8080/upload/2021/07/25/bd6dbd306f344e95b14aee183da32ce5.png","title": "111","content": "1111","createTime": "2021-07-25 12:53:01"},{"id": 6,"userId": 30,"username": "河马先生","userAvatar": "http://47.106.193.0:8080/upload/2021/07/25/bd6dbd306f344e95b14aee183da32ce5.png","title": null,"content": "1111","createTime": "2021-07-25 12:01:55"},{"id": 5,"userId": 30,"username": "河马先生","userAvatar": "http://47.106.193.0:8080/upload/2021/07/25/bd6dbd306f344e95b14aee183da32ce5.png","title": null,"content": "222","createTime": "2021-07-25 12:01:51"}]}}
返回参数说明
参数名 类型 说明
code int 状态码
--- --- ---
msg string 请求消息提示

9.3、根据帖子id获取内容接口

简要描述
  • 根据帖子id获取内容接口
请求URL
请求方式
  • POST
参数
参数名 必选 类型 说明
forumId int 帖子id
--- --- --- ---
后端返回JSON格式数据
{"code": 200,"msg": "查找帖子成功","data": {"userAvatar": "http://47.106.193.0:8080/upload/2021/07/26/101ac55e9d4d4e22857cc0c15607e2b8.png","title": "\b这是我的帖子标题","forumId": 8,"content": "今天买了超级好吃的生鲜哈哈哈哈 太好吃了","username": "josh00"}}

{ "code": 404, "msg": "找不到相关帖子", "data": 9 } ps:9为帖子id

返回参数说明
参数名 类型 说明
title string 帖子标题
--- --- ---
forumId int 帖子id
content stirng 帖子内容