前台-购物车接口

3:购物车接口

  1. 购物车List列表
  2. 购物车添加商品
  3. 更新购物车某个产品数量
  4. 移除购物车某个产品
  5. 购物车选中某个商品
  6. 购物车取消选中某个商品
  7. 查询在购物车里的产品数量
  8. 购物车全选
  9. 购物车取消全选

==购物车List列表==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/cartList
请求头:
Authorization:"token"
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132, //购物车记录id
        "userId": 31,
        "productId": 1,  //商品id
        "productSpecs": "颜色:蓝色;尺寸:16cm;",   //商品规格
        "quantity": 0,  //添加到购物车的商品数量
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 0,
        "productStock": 0,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_FAIL"  //数量限制,添加失败
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==购物车添加商品==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/cartAdd
请求头:
Authorization:"token"
表单数据:
productId=xxx  //产品id ,如  2
count=xx  //产品数量 ,如  2
specs=xx //产品规格 ,如      颜色:蓝色;尺寸:16cm;
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132, //购物车记录id
        "userId": 31,
        "productId": 1,  //商品id
        "productSpecs": "颜色:蓝色;尺寸:16cm;",   //商品规格
        "quantity": 0,  //添加到购物车的商品数量
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 0,
        "productStock": 0,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_FAIL"  //数量限制,添加失败
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==更新购物车某个产品数量==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/cartUpdate
请求头:
Authorization:"token"
表单数据:
cartRecordId=xxx  //购物车记录 id ,如  132
count=xx  //产品数量 ,如  2
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132, //购物车记录id
        "userId": 31,
        "productId": 1,  //商品id
        "productSpecs": "颜色:蓝色;尺寸:16cm;",   //商品规格
        "quantity": 0,  //添加到购物车的商品数量
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 0,
        "productStock": 0,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_FAIL"  //数量限制,添加失败
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==移除购物车某个产品==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/delete_product
请求头:
Authorization:"token"
表单数据:
cartRecordIdSet=xxx  // 要删除的"购物车记录 id",多个产品格式如:  id1,id2,id3,id4,id5,id6
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==购物车选中某个商品==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/select
请求头:
Authorization:"token"
表单数据:
cartRecordId=xxx  //购物车记录 id ,如  132
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132,
        "userId": 31,
        "productId": 1,
        "productSpecs": "颜色:蓝色;尺寸:16cm;",
        "quantity": 2,
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 4132,
        "productStock": 6,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_SUCCESS"
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==购物车取消选中某个商品==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/un_select
请求头:
Authorization:"token"
表单数据:
cartRecordId=xxx  //购物车记录 id ,如  132
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132,
        "userId": 31,
        "productId": 1,
        "productSpecs": "颜色:蓝色;尺寸:16cm;",
        "quantity": 2,
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 4132,
        "productStock": 6,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_SUCCESS"
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==查询在购物车里的产品数量==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/get_cart_product_count
请求头:
Authorization:"token"
success
{
    "status": 0,
    "data": {
        "cartProductVoList": [
            {
                "id": 1,
                "userId": 13,
                "productId": 1,
                "quantity": 12,
                "productName": "iphone7",
                "productSubtitle": "双十一促销",
                "productMainImage": "mainimage.jpg",
                "productPrice": 7199.22,
                "productStatus": 1,
                "productTotalPrice": 86390.64,
                "productStock": 86,
                "productChecked": 1,
                "limitQuantity": "LIMIT_NUM_SUCCESS"
            },
            {
                "id": 2,
                "userId": 13,
                "productId": 2,
                "quantity": 1,
                "productName": "oppo R8",
                "productSubtitle": "oppo促销进行中",
                "productMainImage": "mainimage.jpg",
                "productPrice": 2999.11,
                "productStatus": 1,
                "productTotalPrice": 2999.11,
                "productStock": 86,
                "productChecked": 1,
                "limitQuantity": "LIMIT_NUM_SUCCESS"
            }
        ],
        "allChecked": true,
        "cartTotalPrice": 89389.75
    }
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==购物车全选==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/select_all
请求头:
Authorization:"token"
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132,
        "userId": 31,
        "productId": 1,
        "productSpecs": "颜色:蓝色;尺寸:16cm;",
        "quantity": 2,
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 4132,
        "productStock": 6,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_SUCCESS"
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}
==购物车取消全选==
HttpMethod: POST
Content-Type: application/x-www-form-urlencoded
Url: http://192.168.1.6:8080/player/cart/v1/un_select_all
请求头:
Authorization:"token"
success
{
  "status": 0,
  "data": {
    "cartProductVoList": [
      {
        "cartRecordId": 132,
        "userId": 31,
        "productId": 1,
        "productSpecs": "颜色:蓝色;尺寸:16cm;",
        "quantity": 2,
        "productName": "cup主机01",
        "productSubtitle": "超炫黑色cup",
        "productMainImage": "2017050201.jpg",
        "productPrice": 2066,
        "productStatus": 1,
        "productTotalPrice": 4132,
        "productStock": 6,
        "productChecked": true,
        "limitQuantity": "LIMIT_NUM_SUCCESS"
      }
    ],
    "cartTotalPrice": 0,
    "allChecked": true,
    "imageHost": "http://192.168.1.6:8080/img/"
  },
  "success": true
}
fail
{
    "status": 10,
    "msg": "用户未登录,请登录"
}

转载于:https://my.oschina.net/JoeyChou/blog/889156

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值