3:购物车接口
- 购物车List列表
- 购物车添加商品
- 更新购物车某个产品数量
- 移除购物车某个产品
- 购物车选中某个商品
- 购物车取消选中某个商品
- 查询在购物车里的产品数量
- 购物车全选
- 购物车取消全选
==购物车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": "用户未登录,请登录"
}