ECJiaWiki:Api:goods/product/specification (o2o)

来自ECJiaWiki
跳转至: 导航搜索

应用场景

 获取单个商品的货品和规格信息

接口名称

 goods/product/specification

请求参数

字段名 变量名 必填 类型 示例值 描述
token token string token
商品id goods_id Int 商品id

举例如下

{
      "token" : "79218f8e710fc755a222de45f43c3fd969b87972",
      "goods_id" : 1,
}

返回参数

字段名 变量名 必填 类型 示例值 描述
返回状态码 status Array() {"succeed" : 1} 返回请求接口后的数据,succeed为1代表成功,0则为失败,失败后则返回error_code(错误code)及error_desc(错误说明)
返回信息 data data字典 请求接口提供的返回信息
└ 规格 specification array [] 规格
└货品规格信息 product_specification array 货品规格信息
   └货品id product_id int 货品id
   └货品编号 product_sn string 货品编号
   └货品属性id product_goods_attr string 货品属性id
   └货品库存 product_number int 货品库存
   └货品促销每人限购数 promote_user_limited int 货品促销每人限购数
   └货品价格 product_shop_price float 注:此处返回的价格api已计算处理过;用户端无需自己在累加计算属性价格 货品价格
   └货品价格(格式化) formatted_product_shop_price string 货品价格
   └是否促销 is_promote int 是否促销(0否1是)
   └货品促销价 promote_price int 货品促销价
   └货品促销价(格式化) formatted_promote_price string 货品促销价

成功举例如下

{
    "data": {
        "specification": [
            {
                "attr_type": 1,
                "name": "种类",
                "value": [
                    {
                        "label": "水产",
                        "price": "1",
                        "format_price": "¥1.00",
                        "id": 4127
                    },
                    {
                        "label": "珍珠",
                        "price": "1",
                        "format_price": "¥1.00",
                        "id": 4128
                    }
                ]
            },
            {
                "attr_type": 1,
                "name": "包装",
                "value": [
                    {
                        "label": "简装",
                        "price": "1",
                        "format_price": "¥1.00",
                        "id": 4129
                    },
                    {
                        "label": "礼盒装",
                        "price": "1",
                        "format_price": "¥1.00",
                        "id": 4130
                    }
                ]
            },
            {
                "attr_type": 1,
                "name": "国产/进口",
                "value": [
                    {
                        "label": "国产",
                        "price": "1",
                        "format_price": "¥1.00",
                        "id": 4131
                    },
                    {
                        "label": "进口",
                        "price": "1",
                        "format_price": "¥1.00",
                        "id": 4132
                    }
                ]
            }
        ],
        "product_specification": [
            {
                "product_id": 72,
                "product_name": "货品id72",
                "product_sn": "ECS000462g_p72",
                "product_goods_attr": "4127|4129|4131",
                "product_number": 998,
                "promote_user_limited": 0,
                "promote_limited": 200,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": "195.00",
                "is_promote":1,
                "formatted_promote_price": "¥195.00",
                "img": {
                    "thumb": "http://192.168.1.69/cityo2o/content/uploads/images/201904/product_thumb_img/72_G_1554931355664.jpg",
                    "small": "http://192.168.1.69/cityo2o/content/uploads/images/201904/product_img/72_G_1554931355664.jpg",
                    "url": "http://192.168.1.69/cityo2o/content/uploads/images/201904/product_source_img/72_G_1554931355664.jpg"
                }
            },
            {
                "product_id": 76,
                "product_name": "",
                "product_sn": "ECS000462g_p76",
                "product_goods_attr": "4128|4129|4131",
                "product_number": 1000,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": 0,
                "is_promote":0,
                "formatted_promote_price": "",
                "img": {
                    "thumb": "",
                    "small": "",
                    "url": ""
                }
            },
            {
                "product_id": 74,
                "product_name": "",
                "product_sn": "ECS000462g_p74",
                "product_goods_attr": "4127|4130|4131",
                "product_number": 1000,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": 0,
                "is_promote":0,
                "formatted_promote_price": "",
                "img": {
                    "thumb": "",
                    "small": "",
                    "url": ""
                }
            },
            {
                "product_id": 78,
                "product_name": "",
                "product_sn": "ECS000462g_p78",
                "product_goods_attr": "4128|4130|4131",
                "product_number": 1000,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": 0,
                "is_promote":0,
                "formatted_promote_price": "",
                "img": {
                    "thumb": "",
                    "small": "",
                    "url": ""
                }
            },
            {
                "product_id": 73,
                "product_name": "",
                "product_sn": "ECS000462g_p73",
                "product_goods_attr": "4127|4129|4132",
                "product_number": 1000,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": 0,
                "is_promote":0,
                "formatted_promote_price": "",
                "img": {
                    "thumb": "",
                    "small": "",
                    "url": ""
                }
            },
            {
                "product_id": 77,
                "product_name": "",
                "product_sn": "ECS000462g_p77",
                "product_goods_attr": "4128|4129|4132",
                "product_number": 1000,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": 0,
                "is_promote":0,
                "formatted_promote_price": "",
                "img": {
                    "thumb": "",
                    "small": "",
                    "url": ""
                }
            },
            {
                "product_id": 75,
                "product_name": "",
                "product_sn": "ECS000462g_p75",
                "product_goods_attr": "4127|4130|4132",
                "product_number": 1000,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": 0,
                "is_promote":0,
                "formatted_promote_price": "",
                "img": {
                    "thumb": "",
                    "small": "",
                    "url": ""
                }
            },
            {
                "product_id": 0,
                "product_name": "",
                "product_sn": "",
                "product_goods_attr": "4128|4130|4132",
                "product_number": 0,
                "promote_user_limited": 0,
                "promote_limited": 0,
                "product_shop_price": "163.00",
                "formatted_product_shop_price": "¥163.00",
                "promote_price": "203.00",
                "is_promote":1,
                "formatted_promote_price": "¥203.00",
                "img": []
            }
        ]
    },
    "status": {
        "succeed": 1
    }
}

失败举例如下

注:错误编码