前台商品展示及购物车
sfyr111 edited this page Feb 26, 2018
·
2 revisions
{{host}}/product/name/search?productName=产品&pageNum=1&pageSize=10
productName
pageNum
pageSize
{
"status": 0,
"msg": null,
"data": {
"pageNum": "1",
"pageSize": "10",
"list": [
{
"id": 1,
"categoryId": 1,
"name": "产品名称1",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.13",
"stock": 998,
"status": 1,
"createTime": "2018-02-14T17:39:36.000Z",
"updateTime": "2018-02-26T09:04:41.000Z"
}
],
"total": 5,
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/product/detail/:productId
{
"status": 0,
"msg": null,
"data": {
"id": 1,
"categoryId": 1,
"name": "产品名称1",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.13",
"stock": 998,
"status": 1,
"createTime": "2018-02-14T17:39:36.000Z",
"updateTime": "2018-02-26T09:04:41.000Z"
}
}
{{host}}/product/categoryId/search?categoryId=1&categoryName=分类&pageNum=1&pageSize=10
categoryId: 指定 id 优先级高于分类名称
categoryName
pageNum
pageSize
{
"status": 0,
"msg": null,
"data": {
"pageNum": "1",
"pageSize": "10",
"categoryName": "分类",
"list": [
{
"id": 1,
"categoryId": 1,
"name": "产品名称1",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.13",
"stock": 998,
"status": 1,
"createTime": "2018-02-14T17:39:36.000Z",
"updateTime": "2018-02-26T09:04:41.000Z"
}
],
"total": 5,
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/update
count
productId: 已添加此商品则更新数量
{
"status": 0,
"msg": "添加购物车成功",
"data": {
"totalPrice": "36.45",
"allChecked": false,
"list": [
{
"id": 5,
"userId": 12,
"productId": 5,
"quantity": 2,
"checked": 0,
"createTime": "2018-02-19T07:01:44.000Z",
"updateTime": "2018-02-24T08:43:06.000Z",
"product": {
"id": 5,
"categoryId": 1,
"name": "产品名称2",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.14",
"stock": 1000,
"status": 1,
"createTime": "2018-02-16T13:04:40.000Z",
"updateTime": "2018-02-16T13:04:40.000Z"
}
},
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 1,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T08:23:03.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/list
{
"status": 0,
"data": {
"totalPrice": "36.45",
"allChecked": false,
"list": [
{
"id": 5,
"userId": 12,
"productId": 5,
"quantity": 2,
"checked": 0,
"createTime": "2018-02-19T07:01:44.000Z",
"updateTime": "2018-02-24T08:43:06.000Z",
"product": {
"id": 5,
"categoryId": 1,
"name": "产品名称2",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.14",
"stock": 1000,
"status": 1,
"createTime": "2018-02-16T13:04:40.000Z",
"updateTime": "2018-02-16T13:04:40.000Z"
}
},
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 1,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T08:23:03.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/delete?productIdList=1,5
productIdList: 1, 5 逗号分隔多个商品 id
{
"status": 0,
"msg": "删除购物车成功",
"data": {
"totalPrice": "36.45",
"allChecked": true,
"list": [
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 1,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T08:23:03.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/selectAll
{
"status": 0,
"msg": "选择",
"data": {
"totalPrice": "36.45",
"allChecked": true,
"list": [
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 1,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T09:29:19.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/unSelectAll
{
"status": 0,
"msg": "选择",
"data": {
"totalPrice": 0,
"allChecked": false,
"list": [
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 0,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T09:29:47.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/select/:productId
{
"status": 0,
"msg": "",
"data": {
"totalPrice": "36.45",
"allChecked": true,
"list": [
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 1,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T09:30:46.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/unSelect/5
{
"status": 0,
"msg": "",
"data": {
"totalPrice": 0,
"allChecked": false,
"list": [
{
"id": 12,
"userId": 12,
"productId": 6,
"quantity": 3,
"checked": 0,
"createTime": "2018-02-26T08:23:03.000Z",
"updateTime": "2018-02-26T09:30:59.000Z",
"product": {
"id": 6,
"categoryId": 1,
"name": "产品名称3",
"subtitle": "副标题",
"mainImage": "url1",
"subImages": "url1,url2",
"detail": "详情",
"price": "12.15",
"stock": 954,
"status": 1,
"createTime": "2018-02-24T08:27:48.000Z",
"updateTime": "2018-02-24T08:27:48.000Z"
}
}
],
"host": "oss-cn-hangzhou.aliyuncs.com"
}
}
{{host}}/cart/count
{
"status": 0,
"msg": null,
"data": {
"count": "3"
}
}