# 商品接口

# 商品分类列表

调用地址 https://demo.dbshop.net/shop-api/goods/classList (opens new window)
请求方法 classList
请求类型 get
参数 必填 参数说明
classId 当classId等于0时,输出所有分类,大于0时,输出对应分类的下级分类,包括当前分类 【分类必须是已启用】
level 分类需要输出的层级,默认为0,输出所有层级
{
    "status": "success",
    "code": 200,
    "result": [
        {
            "classId": 5,
            "classTopId": 0,
            "className": "家用电器",
            "classPath": "5",
            "classInfo": null,
            "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635924895",
            "classState": 1,
            "classExtend": "",
            "classKeywords": "",
            "classDescription": "",
            "classTagGroup": "a:0:{}",
            "classSort": 1,
            "classPathNum": 0
        },
        {
            "classId": 6,
            "classTopId": 5,
            "className": "洗衣机",
            "classPath": "5,6",
            "classInfo": null,
            "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635924895",
            "classState": 1,
            "classExtend": "",
            "classKeywords": "",
            "classDescription": "",
            "classTagGroup": "a:0:{}",
            "classSort": 1,
            "classPathNum": 1
        }
    ]
}

# 商品顶级及二级分类

调用地址 https://demo.dbshop.net/shop-api/goods/topAndSubClass (opens new window)
请求方法 topAndSubClass
请求类型 get
{
    "status": "success",
    "code": 200,
    "result": [
        {
            "classId": 5,
            "classTopId": 0,
            "className": "家用电器",
            "classPath": "5",
            "classInfo": null,
            "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925213",
            "classState": 1,
            "classExtend": "",
            "classKeywords": "",
            "classDescription": "",
            "classTagGroup": "a:0:{}",
            "classSort": 1,
            "classPathNum": 0,
            "subClass": [
                {
                    "classId": 6,
                    "classTopId": 5,
                    "className": "洗衣机",
                    "classPath": "5,6",
                    "classInfo": null,
                    "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925213",
                    "classState": 1,
                    "classExtend": "",
                    "classKeywords": "",
                    "classDescription": "",
                    "classTagGroup": "a:0:{}",
                    "classSort": 1,
                    "classPathNum": 1
                },
                {
                    "classId": 7,
                    "classTopId": 5,
                    "className": "电冰箱",
                    "classPath": "5,7",
                    "classInfo": null,
                    "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925213",
                    "classState": 1,
                    "classExtend": "",
                    "classKeywords": "",
                    "classDescription": "",
                    "classTagGroup": "a:0:{}",
                    "classSort": 2,
                    "classPathNum": 1
                },
                {
                    "classId": 8,
                    "classTopId": 5,
                    "className": "电视",
                    "classPath": "5,8",
                    "classInfo": null,
                    "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925213",
                    "classState": 1,
                    "classExtend": "",
                    "classKeywords": "",
                    "classDescription": "",
                    "classTagGroup": "a:0:{}",
                    "classSort": 3,
                    "classPathNum": 1
                },
                {
                    "classId": 9,
                    "classTopId": 5,
                    "className": "空调",
                    "classPath": "5,9",
                    "classInfo": null,
                    "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925213",
                    "classState": 1,
                    "classExtend": "",
                    "classKeywords": "",
                    "classDescription": "",
                    "classTagGroup": "a:0:{}",
                    "classSort": 4,
                    "classPathNum": 1
                }
            ]
        }
    ]
}

# 商品分类信息

调用地址 https://demo.dbshop.net/shop-api/goods/classInfo (opens new window)
请求方法 classInfo
请求类型 get
参数 必填 参数说明
classId 商品分类id
{
    "status": "success",
    "code": 200,
    "result": {
        "classId": 5,
        "classTopId": 0,
        "className": "家用电器",
        "classPath": "5",
        "classInfo": null,
        "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925442",
        "classState": 1,
        "classExtend": "",
        "classKeywords": "",
        "classDescription": "",
        "classTagGroup": "a:0:{}",
        "classSort": 1
    }
}

# 商品列表

调用地址 https://demo.dbshop.net/shop-api/goods/goodsList (opens new window)
请求方法 goodsList
请求类型 get
参数 必填 参数说明
classId 商品分类id
page 分页页数,默认为1
qty 每页显示商品数量,默认是10
sortType 排序类型 priceASC、priceDESC、clickASC、clickDESC、timeASC、timeDESC
tagGroupId 标签组id
tag 标签数组
brandId 品牌id
userToken 登录状态标记,如果会员已经登录,则需要填写
{
    "status": "success",
    "code": 200,
    "result": {
        "goodsList": [
            {
                "goodsId": 8,
                "mainClassId": 8,
                "classId": 5,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/2094d0cd98ddee55b1a5696434f43483_thumb.jpg",
                "goodsItem": "DBS000008",
                "brandId": 0,
                "goodsName": "小米(MI)电视4A标准版 L55M5-AZ/L55M5-AD 55英寸",
                "goodsExtendName": "K超高清 HDR 人工智能液晶网络平板电视",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": 0,
                "goodsPrice": "¥2,200.00",
                "virtualSales": 0,
                "goodsSalesNum": 3,
                "goodsType": 1,
                "goodsClick": 0
            },
            {
                "goodsId": 7,
                "mainClassId": 8,
                "classId": 5,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/c534950c4a79ea20293e483fd4ed4aff_thumb.jpg",
                "goodsItem": "DBS000007",
                "brandId": 0,
                "goodsName": "索尼(SONY)KD-55X8000E 55英寸 4K超高清",
                "goodsExtendName": "智能安卓7.0 享受视觉盛宴 醇音技术",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": 0,
                "goodsPrice": "¥5,199.00",
                "virtualSales": 0,
                "goodsSalesNum": 5,
                "goodsType": 1,
                "goodsClick": 0
            },
            {
                "goodsId": 3,
                "mainClassId": 7,
                "classId": 5,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/81b235c99ff28f59f6d1f74723de3bef_thumb.jpg",
                "goodsItem": "DBS000003",
                "brandId": 0,
                "goodsName": "美的(Midea)BCD-525WKPZM(E) 星际银 525升对开门电冰箱",
                "goodsExtendName": "双变频风冷 APP智能操控 轻薄机身",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": "¥4,000.00",
                "goodsPrice": "¥3,099.00",
                "virtualSales": 0,
                "goodsSalesNum": 0,
                "goodsType": 1,
                "goodsClick": 0
            },
            {
                "goodsId": 2,
                "mainClassId": 6,
                "classId": 5,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/ac41193ced77f8867f40b331fb6286fe_thumb.jpg",
                "goodsItem": "DBS000002",
                "brandId": 0,
                "goodsName": "西门子(SIEMENS) XQG100-WM14U561HW 10公斤 变频 一键智能除渍",
                "goodsExtendName": "家居互联远程操控,特渍洗程序,256种水位调节,90℃高温筒清洁,LED全触控界面",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": 0,
                "goodsPrice": "¥5,399.00",
                "virtualSales": 0,
                "goodsSalesNum": 1,
                "goodsType": 1,
                "goodsClick": 0
            }
        ],
        "classTagGroup": [],
        "classTag": [],
        "classBrand": [],
        "currentClass": [
            {
                "classId": 5,
                "className": "家用电器",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 4,
                "className": "手机数码",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 3,
                "className": "家具家居",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 2,
                "className": "卫浴",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 1,
                "className": "服装鞋帽",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            }
        ],
        "subClass": [
            {
                "classId": 6,
                "className": "洗衣机",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 7,
                "className": "电冰箱",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 8,
                "className": "电视",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            },
            {
                "classId": 9,
                "className": "空调",
                "classImage": "https://demo.dbshop.net/upload/common/shop_class.png?v=1635925576"
            }
        ]
    }
}

# 商品品牌列表

调用地址 https://demo.dbshop.net/shop-api/goods/brandList (opens new window)
请求方法 brandList
请求类型 get
{
    "status": "success",
    "code": 200,
    "result": [
        {
            "brandId": 1,
            "brandName": "苹果",
            "brandNameExtend": "",
            "brandLogo": "https://demo.dbshop.net/upload/common/shop_brand.png?v=1635925925",
            "brandInfo": "<p>苹果电脑</p>",
            "brandKeywords": "",
            "brandDescription": ""
        }
    ]
}

# 商品品牌信息

调用地址 https://demo.dbshop.net/shop-api/goods/brandInfo (opens new window)
请求方法 brandInfo
请求类型 get
参数 必填 参数说明
brandId 商品品牌id
{
    "status": "success",
    "code": 200,
    "result": {
        "brandId": 1,
        "brandName": "苹果",
        "brandNameExtend": "",
        "brandLogo": "https://demo.dbshop.net/upload/common/shop_brand.png?v=1635926002",
        "brandInfo": "<p>苹果电脑</p>",
        "brandKeywords": "",
        "brandDescription": ""
    }
}

# 品牌商品列表

调用地址 https://demo.dbshop.net/shop-api/goods/brandGoodsList (opens new window)
请求方法 brandGoodsList
请求类型 get
参数 必填 参数说明
brandId 商品品牌id
sortType 排序类型 priceASC、priceDESC、clickASC、clickDESC、timeASC、timeDESC
page 分页页数,默认为1
qty 每页显示商品数量,默认是10
userToken 登录状态标记,如果会员已经登录,则需要填写
{
    "status": "success",
    "code": 200,
    "result": {
        "goodsList": [
            {
                "goodsId": 6,
                "mainClassId": 10,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/b4fe9d54e6ce250c1a0519f16c71cc24_thumb.jpg",
                "goodsItem": "DBS000006",
                "brandId": 1,
                "goodsName": "苹果(Apple) iPhone X 64GB 深空灰色 移动联通电信全网通4G手机",
                "goodsExtendName": "5.8英寸全面屏,无线充电,面容ID识别",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": 0,
                "goodsPrice": "¥6,158.00",
                "virtualSales": 0,
                "goodsSalesNum": 1,
                "goodsType": 1,
                "goodsClick": 0
            }
        ],
        "brandInfo": {
            "brandId": 1,
            "brandName": "苹果",
            "brandNameExtend": "",
            "brandLogo": "https://demo.dbshop.net/upload/common/shop_brand.png?v=1635926285",
            "brandInfo": "<p>苹果电脑</p>",
            "brandKeywords": "",
            "brandDescription": ""
        }
    }
}

# 商品搜索结果列表

调用地址 https://demo.dbshop.net/shop-api/goods/searchGoods (opens new window)
请求方法 searchGoods
请求类型 get
参数 必填 参数说明
keywords 搜索关键字
sortType 排序类型 priceASC、priceDESC、clickASC、clickDESC、timeASC、timeDESC
page 分页页数,默认为1
qty 每页显示商品数量,默认是10
userToken 登录状态标记,如果会员已经登录,则需要填写
{
    "status": "success",
    "code": 200,
    "result": {
        "goodsList": [
            {
                "goodsId": 8,
                "mainClassId": 8,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/2094d0cd98ddee55b1a5696434f43483_thumb.jpg",
                "goodsItem": "DBS000008",
                "brandId": 0,
                "goodsName": "小米(MI)电视4A标准版 L55M5-AZ/L55M5-AD 55英寸",
                "goodsExtendName": "K超高清 HDR 人工智能液晶网络平板电视",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": 0,
                "goodsPrice": "¥2,200.00",
                "virtualSales": 0,
                "goodsSalesNum": 3,
                "goodsType": 1,
                "goodsClick": 0
            },
            {
                "goodsId": 7,
                "mainClassId": 8,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/c534950c4a79ea20293e483fd4ed4aff_thumb.jpg",
                "goodsItem": "DBS000007",
                "brandId": 0,
                "goodsName": "索尼(SONY)KD-55X8000E 55英寸 4K超高清",
                "goodsExtendName": "智能安卓7.0 享受视觉盛宴 醇音技术",
                "goodsWeight": 0,
                "goodsWeightUnit": "克",
                "goodsMarketPrice": 0,
                "goodsPrice": "¥5,199.00",
                "virtualSales": 0,
                "goodsSalesNum": 5,
                "goodsType": 1,
                "goodsClick": 0
            }
        ]
    }
}

# 商品详情

调用地址 https://demo.dbshop.net/shop-api/goods/index (opens new window)
请求方法 index
请求类型 get
参数 必填 参数说明
goodsId 商品id
classId 商品分类id,只在商品列表时,传递,因为同一个商品可以有多个商品分类,选择当前分类id传送
userToken 登录状态标记,如果会员已经登录,则需要填写
{
    "status": "success",
    "code": 200,
    "result": {
        "classId": 10,
        "inClassInfo": {
            "classId": 10,
            "classTopId": 4,
            "className": "手机通讯",
            "classPath": "4,10",
            "classInfo": null,
            "classImage": null,
            "classState": 1,
            "classExtend": "",
            "classKeywords": "",
            "classDescription": "",
            "classTagGroup": "a:0:{}",
            "classSort": 1
        },
        "goodsInfo": {
            "goodsId": 1,
            "goodsItem": "DBS000001",
            "classId": 10,
            "brandId": 0,
            "goodsName": "小米Mix3 全网通版 8GB+128GB 黑色 | 磁动力滑盖全面屏",
            "goodsExtendName": "磁动力滑盖全面屏,前置双摄",
            "stockId": 1,
            "goodsWeight": 0,
            "goodsWeightConversion": 1,
            "goodsWeightUnit": "克",
            "goodsKeywords": "",
            "goodsDescription": "",
            "goodsMarketPrice": "0.00",
            "goodsPrice": "¥3,558.00",
            "goodsBody": "",
            "virtualSales": 0,
            "goodsState": 1,
            "goodsImageId": 1,
            "goodsType": 1,
            "goodsTagStr": null,
            "attributeGroupId": 0,
            "wholesaleState": 0,
            "goodsIntegralBuy": 0,
            "goodsClick": null,
            "goodsAddTime": 1603857735,
            "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/b4793d059bbfb5c56537be2d0de9bef8_thumb.jpg",
            "goodsImage": "https://demo.dbshop.net/upload/goods/image/b4793d059bbfb5c56537be2d0de9bef8.jpg",
            "goodsSalesNum": 1,
            "brandName": null,
            "discountPrice": "0.00",
            "discountStartTime": 0,
            "discountEndTime": 0,
            "discountUserGroupType": "allUser",
            "discountUserGroup": "N;",
            "stockNum": 9,
            "stockShowState": 0,
            "stockShow": "1",
            "stockOutSetNum": 0,
            "stockOutShow": "1",
            "cartBuyMinNum": 0,
            "cartBuyMaxNum": 0,
            "goodsIntegralBuyNum": 0,
            "salesNum": 1
        },
        "goodsImages": [
            {
                "goodsImageId": 1,
                "goodsId": 1,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/b4793d059bbfb5c56537be2d0de9bef8_thumb.jpg",
                "goodsImage": "https://demo.dbshop.net/upload/goods/image/b4793d059bbfb5c56537be2d0de9bef8.jpg",
                "imageSlide": 1,
                "imageCode": "",
                "imageSort": 255
            },
            {
                "goodsImageId": 2,
                "goodsId": 1,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/4b24eaedb431b880978c1617dc948810_thumb.jpg",
                "goodsImage": "https://demo.dbshop.net/upload/goods/image/4b24eaedb431b880978c1617dc948810.jpg",
                "imageSlide": 1,
                "imageCode": "",
                "imageSort": 255
            },
            {
                "goodsImageId": 3,
                "goodsId": 1,
                "goodsThumbnailImage": "https://demo.dbshop.net/upload/goods/image/db5db1718bd131c8bf92da06ac657fea_thumb.jpg",
                "goodsImage": "https://demo.dbshop.net/upload/goods/image/db5db1718bd131c8bf92da06ac657fea.jpg",
                "imageSlide": 1,
                "imageCode": "",
                "imageSort": 255
            }
        ],
        "userGroup": [],
        "goodsCustom": [],
        "goodsSpec": [],
        "goodsAttribute": null,
        "goodsCommonContent": [
            {
                "contentBody": "<p><span style=\"font-size: 20px; color: rgb(255, 0, 0);\">当前商品皆为演示商品,不产生实际交易,请不要进行付款操作。</span></p>"
            }
        ],
        "goodsWholesaleList": [],
        "showData": {
            "couponArray": [],
            "discountArray": []
        }
    }
}

# 规格商品信息

调用地址 https://demo.dbshop.net/shop-api/goods/goodsSpecInfo (opens new window)
请求方法 goodsSpecInfo
请求类型 get
参数 必填 参数说明
goodsId 商品id
tIdStr 商品规格id字符串,用英文逗号分隔 如 3,5,6
{
    "status": "success",
    "code": 200,
    "result": {
        "specGoodsInfo": {
            "inSpecGoodsId": 2,
            "specTagId": "1-4",
            "tagIdStr": "14",
            "specGoodsPrice": "¥8,000.00",
            "specGoodsStock": 10,
            "specGoodsItem": "DBS000006-2",
            "specGoodsWeight": 0,
            "specGoodsUserGroupPrice": [],
            "goodsId": 6
        },
        "specImages": null,
        "selectedSpecTagId": [
            "1",
            "4"
        ]
    }
}

# 商品收藏添加与取消

调用地址 https://demo.dbshop.net/shop-api/goods/addGoodsFavorites (opens new window)
请求方法 addGoodsFavorites
请求类型 get
参数 必填 参数说明
goodsId 商品id
userToken 登录状态标记

未收藏返回

{
    "status": "success",
    "code": 200,
    "result": {
        "favoritesState": "add",
        "favoritesId": 1,
        "message": "商品收藏完成!"
    }
}

已收藏返回

{
    "status": "success",
    "code": 200,
    "result": {
        "favoritesState": "remove",
        "favoritesId": 0,
        "message": "取消收藏!"
    }
}

# 获取商品收藏状态

调用地址 https://demo.dbshop.net/shop-api/goods/goodsFavoritesInfo (opens new window)
请求方法 goodsFavoritesInfo
请求类型 get
参数 必填 参数说明
goodsId 商品id
userToken 登录状态标记
{
    "status": "success",
    "code": 200,
    "result": {
        "goodsId": 3,
        "favorite": "false"
    }
}

# 商品咨询列表

调用地址 https://demo.dbshop.net/shop-api/goods/goodsConsultList (opens new window)
请求方法 goodsConsultList
请求类型 get
参数 必填 参数说明
goodsId 商品id
page 分页页数,默认为1
qty 每页显示商品数量,默认是10
{
    "status": "success",
    "code": 200,
    "result": {
        "consultList": [
            {
                "consultId": 1,
                "userAvatar": "https://demo.dbshop.net/upload/common/default_user_avatar.png?v=1635927457",
                "consultUser": "游*",
                "consultContent": "请问价格可以便宜一些吗",
                "consultTime": 1635927436,
                "consultShopTime": "2021-11-03 16:17",
                "replyUser": "店主",
                "replyContent": "不可以的",
                "replyTime": 1635927449,
                "replyShowTime": "2021-11-03 16:17"
            }
        ]
    }
}

# 添加商品咨询

调用地址 https://demo.dbshop.net/shop-api/goods/addGoodsConsult (opens new window)
请求方法 addGoodsConsult
请求类型 post
参数 必填 参数说明
goodsId 商品id
consultContent 咨询内容
userToken 登录状态标记,如果会员已经登录,则需要填写
{
    "status": "success",
    "code": 200,
    "result": {
        "message": "咨询添加完成"
    }
}

# 商品评价列表

调用地址 https://demo.dbshop.net/shop-api/goods/goodsEvaluationList (opens new window)
请求方法 goodsEvaluationList
请求类型 get
参数 必填 参数说明
goodsId 商品id
page 分页页数,默认为1
qty 每页显示商品数量,默认是10
{
    "status": "success",
    "code": 200,
    "result": {
        "evaluationList": [
            {
                "evaluationId": 1,
                "userAvatar": "https://demo.dbshop.net/upload/common/default_user_avatar.png?v=1635928771",
                "userName": "流**水",
                "evaluationBody": "商品很好",
                "evaluationStar": 5,
                "evaluationTime": 1635928498,
                "evaluationShopTime": "2021-11-03 16:34",
                "replyBody": "感谢捧场",
                "replyTime": 1635928644,
                "replyShowTime": "2021-11-03 16:37",
                "replyUser": "店主"
            }
        ]
    }
}

# 优惠券列表

调用地址 https://demo.dbshop.net/shop-api/goods/couponList (opens new window)
请求方法 couponList
请求类型 get
参数 必填 参数说明
goodsId 商品id
userToken 登录状态标记,如果会员已经登录,则需要填写
{
    "status": "success",
    "code": 200,
    "result": {
        "goodsCoupon": [
            {
                "couponId": 1,
                "couponTitle": "满100减1元",
                "couponInfo": "满100减1元,优惠不断",
                "couponStartTime": 0,
                "couponEndTime": 0,
                "couponState": 1,
                "shoppingAmount": 100,
                "shoppingDiscount": 1,
                "getCouponStartTime": 0,
                "getCouponEndTime": 0,
                "getCouponType": "click",
                "getShoppingAmount": 1,
                "userGetFrequency": 1,
                "getUserType": "allUser",
                "getUserGroup": "a:0:{}",
                "getGoodsType": "allGoods",
                "getGoodsBody": "a:0:{}",
                "userCouponId": null,
                "couponStartAndEndTime": "长期有效"
            }
        ]
    }
}

# 获取优惠券

调用地址 https://demo.dbshop.net/shop-api/goods/clickGetCoupon (opens new window)
请求方法 clickGetCoupon
请求类型 get
参数 必填 参数说明
goodsId 商品id
couponId 优惠券id
userToken 登录状态标记
{
    "status": "success",
    "code": 200,
    "result": []
}