产品模块
产品分类
接口地址
请求方式:GET 不需要授权
{host}/api/categories
响应结果
{
"code": "200",
"msg": "ok",
"data": {
"has_more": false,
"list": [{
"id": 1,
"title": "手机数码",
"image_url": "FmlrYg6qHTTXauIYWD2AFlU6cGGqlRYzceYwj0g3.png",
"product_count": "3"
}, {
"id": 2,
"title": "家用电器",
"image_url": "mGYNjJh6qADPDQUOlsrFLy6IcX7aeAvwJpYq999q.png",
"product_count": "1"
}, {
"id": 3,
"title": "电脑办公",
"image_url": "taHzo4ZJE6yc8bB0LEKGbz17noQetsezPHyjH9tF.png",
"product_count": "0"
}, {
"id": 4,
"title": "汽车用品",
"image_url": "6GQAwEgHQjPHQH7cKEqqvSruLkj7CJ55jxW4Rc0C.png",
"product_count": "0"
}]
}
}
产品分类(按层级格式返回)
接口地址
请求方式:GET 不需要授权
{host}/api/categories/tree
响应结果
{
"code": "200",
"msg": "ok",
"data": [{
"id": 1,
"title": "手机数码",
"image_url": "FmlrYg6qHTTXauIYWD2AFlU6cGGqlRYzceYwj0g3.png",
"product_count": "3",
"child_recursive": [{
"id": 5,
"title": "三星",
"subtitle": null,
"image_url": null,
"product_count": "2"
}, {
"id": 6,
"title": "魅族",
"subtitle": null,
"image_url": null,
"product_count": "0"
}, {
"id": 7,
"title": "小米",
"subtitle": null,
"image_url": null,
"product_count": "1"
}, {
"id": 8,
"title": "华为",
"subtitle": null,
"image_url": null,
"product_count": "0"
}, {
"id": 9,
"title": "OPPO",
"subtitle": null,
"image_url": null,
"product_count": "0"
}]
}, {
"id": 2,
"title": "家用电器",
"image_url": "mGYNjJh6qADPDQUOlsrFLy6IcX7aeAvwJpYq999q.png",
"style_title": "家用电器",
"product_count": "1",
"child_recursive": [{
"id": 10,
"title": "多用途锅",
"subtitle": null,
"image_url": null,
"product_count": "1"
}, {
"id": 11,
"title": "豆浆机",
"subtitle": null,
"image_url": null,
"product_count": "0"
}, {
"id": 12,
"title": "电饼铛",
"subtitle": null,
"image_url": null,
"product_count": "0"
}]
}, {
"id": 3,
"title": "电脑办公",
"image_url": "taHzo4ZJE6yc8bB0LEKGbz17noQetsezPHyjH9tF.png",
"product_count": "0",
"child_recursive": [{
"id": 13,
"title": "轻薄本",
"subtitle": null,
"image_url": null,
"product_count": "0"
}]
}, {
"id": 4,
"title": "汽车用品",
"image_url": "6GQAwEgHQjPHQH7cKEqqvSruLkj7CJ55jxW4Rc0C.png",
"product_count": "0",
"child_recursive": []
}]
}
产品列表
接口地址
请求方式:GET 不需要授权
{host}/api/products
响应结果
{
"code": "200",
"msg": "ok",
"data": {
"has_more": false,
"list": [{
"product_code": "SJ001",
"title": "三星 Galaxy S21 5G(SM-G9910)双模5G 骁龙888 超高清专业摄像 120Hz护目屏 游戏手机",
"main_photo_url": "GhjLXFWsMcMGqjGDB5l1W7UjC1oVt4Dkwjevk7GQ.jpg",
"sale_price": "1899.00",
"market_price": "1999.00",
"sales_total": 104,
"vip_price": "1899.00"
}, {
"product_code": "SP0001",
"title": "荣耀 V10全网通 移动联通电信4G全面屏手机 双卡双待",
"main_photo_url": "OULPaiMC5XMoGabuwfMY69g2K3cHEzoiLL3psFH5.jpg",
"sale_price": "1899.00",
"market_price": "1999.00",
"sales_total": 99,
"vip_price": "1899.00"
}, {
"product_code": "2323",
"title": "测试商品属性",
"main_photo_url": "HwZ15bfT9FCQJ3c5SvVldEHyUWvHKzyaSEVOr7fB.png",
"sale_price": "3.00",
"market_price": "3.00",
"sales_total": 0,
"vip_price": "3.00"
}]
}
}
产品详情
接口地址
请求方式:GET 不需要授权
{host}/api/products/{code}
请求参数
参数名 | 数据类型 | 是否必须 |
---|---|---|
code | string | 是 |
响应结果
{
"code": "200",
"msg": "ok",
"data": {
"id": 3,
"product_code": "00003",
"title": "【舒尔健动感单车】大型健身器械 减肥神器",
"spec_type": {
"value": 0,
"key": "SINGLE",
"description": "统一规格"
},
"main_photo_url": "pV6hxHuV7AFmFinNCRzui2wITBydog4CqOOWsj3B.png",
"sale_price": "200.00",
"market_price": "1556.00",
"describe": null,
"content": "",
"sales_total": 29,
"images": [],
"tags": [{
"value": "促销"
}, {
"value": "热卖"
}],
"skus": [{
"id": 11,
"product_id": 3,
"spec_option_ids": "",
"sku_code": "00003",
"image_url": "pV6hxHuV7AFmFinNCRzui2wITBydog4CqOOWsj3B.png",
"market_price": "1556.00",
"sale_price": "200.00",
"stock_num": 91,
"sales_real": 28,
"vip_price": "200.00"
}],
"vip_price": "200.00",
"specs": [],
"attrs": []
}
}