简要描述:

  • 用户购物车接口

接口版本:

版本号 制定人 制定日期 修订日期
1.0.0 孙程 2019-05-28

请求URL:

请求方式:

  • POST

请求头:

参数名 是否必须 类型 说明
Content-Type
Content-MD5

请求参数:

参数名 是否必须 类型 说明
uid int 用户ID
step string 列表:list;添加:add;更新:update;移除:del;清空:empty
goods_id int 商品ID,step为add时,商品ID不能为空
qty int 数量,step为add/update时,数量不能为空
options string 商品规格,例如颜色/尺码,格式为规格id用’-‘连接组合的字符串:3-4
cartid int step为update/del时,该参数时必须的

返回示例:

正确时返回(例子):

{
    "errcode": 0,
    "msg": "添加成功",
    "data": [
        {
            "id": 487,
            "user_id": 99,
            "goods_id": 1,
            "goods_name": "【断底断面包退换】内增高网面小白鞋女夏韩版休闲运动鞋女",
            "now_price": "30.60",
            "goods_image": "915cd1bcdcbef0d.jpg",
            "cate_id": 71,
            "spec": [
                [
                    {
                        "id": 58,
                        "type_id": 1,
                        "goods_id": 1,
                        "opt_text": "黑色",
                        "name": "颜色"
                    }
                ],
                [
                    {
                        "id": 59,
                        "type_id": 2,
                        "goods_id": 1,
                        "opt_text": "29",
                        "name": "尺码"
                    }
                ]
            ],
            "qty": 4,
            "created_date": "2019-05-28 15:55:16"
        },
        {
            "id": 486,
            "user_id": 99,
            "goods_id": 1,
            "goods_name": "【断底断面包退换】内增高网面小白鞋女夏韩版休闲运动鞋女",
            "now_price": "30.60",
            "goods_image": "915cd1bcdcbef0d.jpg",
            "cate_id": 71,
            "spec": [
                [
                    {
                        "id": 57,
                        "type_id": 1,
                        "goods_id": 1,
                        "opt_text": "白色",
                        "name": "颜色"
                    }
                ],
                [
                    {
                        "id": 60,
                        "type_id": 2,
                        "goods_id": 1,
                        "opt_text": "31",
                        "name": "尺码"
                    }
                ]
            ],
            "qty": 1,
            "created_date": "2019-05-28 15:42:05"
        }
    ],
    "cart_amount": "153.00"
}
{
    "errcode": 0,
    "msg": "更新成功",
    "data": [
        {
            "id": 479,
            "user_id": 99,
            "goods_id": 17,
            "goods_name": "雪纺衫女长袖2019春装新款打底衫女韩版衬衫女宽松雪纺上衣女小衫",
            "now_price": "15.90",
            "goods_image": "685cd3e99b833e1.jpg",
            "cate_id": 71,
            "spec": "",
            "qty": 3,
            "created_date": "2019-05-28 14:56:16"
        },
        {
            "id": 480,
            "user_id": 99,
            "goods_id": 1,
            "goods_name": "【断底断面包退换】内增高网面小白鞋女夏韩版休闲运动鞋女",
            "now_price": "30.60",
            "goods_image": "915cd1bcdcbef0d.jpg",
            "cate_id": 71,
            "spec": [
                [
                    {
                        "id": 58,
                        "type_id": 1,
                        "goods_id": 1,
                        "opt_text": "黑色",
                        "name": "颜色"
                    }
                ],
                [
                    {
                        "id": 59,
                        "type_id": 2,
                        "goods_id": 1,
                        "opt_text": "29",
                        "name": "尺码"
                    }
                ]
            ],
            "qty": 1,
            "created_date": "2019-05-28 14:06:38"
        }
    ],
    "cart_amount": "78.30"
}

错误时返回(例子):

{
    "errcode": -1,
    "msg": "失败"
}

返回参数说明:

参数名 类型 说明
id int 购物车id
user_id int 用户id
goods_id int 商品id
cate_id int 分类id
goods_name string 商品标题
now_price float 商品价格
goods_image float 商品主图:完整配置路径示例F:/sun/union-shop/PHP/public/uploads/goods/prime/0/文件名
spec string 商品规格

备注:

  • 更多返回错误代码请看下面
    201 请求方式错误,要求post
    202 方法不存在
    203 参数错误,查看msg
文档更新时间: 2019-07-15 19:49   作者:jetsamsun
上一篇:
下一篇: