商品搜索接口
URL地址 | http://www.tpshop.com/index.php?m=Api&c=Goods&a=search |
请求方式 | get |
参数列表
参数 | 是否必须 | 说明 |
q | 必须 | 搜索关键字 |
p | 必须 小写 p | 当前页数 默认1 |
{
"status": 1,
"msg": "获取成功",
"result": {
"goods_list": [ //商品列表
{
"goods_id": "1",
"cat_id": "12",
"goods_sn": "TP000000",
"goods_name": "Apple iPhone 6s Plus 16G 玫瑰金 移动联通电信4G手机",
"shop_price": "6000.00",
"comment_count": "4"
}
],
"filter_spec": [ //商品规格
{
"name": "网络",
"item": [
{
"name": "4G",
"href": "/Api/Goods/goodsList/id/1/spec/5_11",
"id": 1
},
{
"name": "3G",
"href": "/Api/Goods/goodsList/id/1/spec/5_12",
"id": 2
}
]
}
],
"filter_attr": [ //商品属性
{
"name": "操作系统",
"item": [
{
"name": "Android 4.4+EMUI 3.0",
"href": "/Api/Goods/goodsList/id/1/attr/69_Android 4.4+EMUI 3.0",
"id": 25
},
{
"name": "EMUI 3.1(兼容Android 5.1)",
"href": "/Api/Goods/goodsList/id/1/attr/69_EMUI 3.1(兼容Android 5.1)",
"id": 26
},
{
"name": "华为 EMUI 3.1(兼容 Android 5.0)",
"href": "/Api/Goods/goodsList/id/1/attr/69_华为 EMUI 3.1(兼容 Android 5.0)",
"id": 27
},
{
"name": "华为 EMUI 4.0(兼容Android 6.0)",
"href": "/Api/Goods/goodsList/id/1/attr/69_华为 EMUI 4.0(兼容Android 6.0)",
"id": 28
},
{
"name": "android",
"href": "/Api/Goods/goodsList/id/1/attr/69_android",
"id": 29
},
{
"name": "IOS",
"href": "/Api/Goods/goodsList/id/1/attr/69_IOS",
"id": 30
},
{
"name": "ios",
"href": "/Api/Goods/goodsList/id/1/attr/69_ios",
"id": 31
}
]
}
],
"filter_brand": [ //品牌
{
"name": "首信/capital",
"hreg": "/Api/Goods/goodsList/id/1/brand_id/11",
"id": 75
},
{
"name": "现代/HYUNDAI",
"hreg": "/Api/Goods/goodsList/id/1/brand_id/17",
"id": 76
}
],
"filter_price": [ //价格范围
{
"name": "1360以下",
"href": "/Api/Goods/goodsList/id/1/price/0-1360",
"id": 77
},
{
"name": "1360-2720",
"href": "/Api/Goods/goodsList/id/1/price/1360-2720",
"id": 78
}],
"sort": "goods_id", //排序字段: 商品ID排序
"sort_asc": "asc", //排序类型: 升序排序
"orderby_default": "/Api/Goods/goodsList/id/1", //排序字段: 默认排序(全部)
"orderby_sales_sum": "/Api/Goods/goodsList/id/1/sort/sales_sum/sort_asc/desc", //排序字段:销量排序
"orderby_price": "/Api/Goods/goodsList/id/1/sort/shop_price/sort_asc/desc", //排序字段:价格排序
"orderby_comment_count": "/Api/Goods/goodsList/id/1/sort/comment_count/sort_asc/desc",//排序字段: 评论数量排序
"orderby_is_new": "/Api/Goods/goodsList/id/1/sort/is_new/sort_asc/desc" //排序字段: 新品
}
}
注意: 请求URL的组装.
1. 默认请求URL是: http://www.tpshop.com/index.php?m=Api&c=Goods&a=search
2. 用户点击了某个筛选属性, 请求URL是: http://www.tpshop.com + 筛选属性对应的href, 其他参数不变,
例如, 用户点击了"网络 4G"筛选属性, 完整的请求URL应该是: http://www.tpshop.com/Api/Goods/goodsList/id/1/spec/5_11