商品列表 API 文档
接口说明
获取附近商品列表,支持按类型筛选(附近商品、全额兑换等)
请求地址
GET plugin.exchange-link.frontend.index.goodsList
请求参数
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
attribute_type | int | 是 | 列表类型(1-4) |
lng | float | 是 | 用户所在经度 |
lat | float | 是 | 用户所在纬度 |
page | int | 否 | 分页页码(默认1) |
列表类型说明
值 | 说明 |
---|---|
1 | 附近商品(按距离排序) |
2 | 全额兑换商品 |
3 | 火爆推荐+附近商品 |
4 | 销量TOP+附近商品 |
响应JSON结构说明
{
"result": 1,
"msg": "ok",
"data": {
"current_page": 1,
"data": [
{
"id": 543,
"show_sales": 1111111,
"distance": 1887.4,
"unit": "km",
"title": "商品ID18",
"show_price": "¥1.00",
"has_one_exchange_link_goods": null
},
// 更多商品对象...
],
"first_page_url": "http://example.com/api?page=1",
"from": 1,
"last_page": 2,
"last_page_url": "http://example.com/api?page=2",
"links": [
{
"url": null,
"label": "« 上一页",
"active": false
},
// 更多分页链接...
],
"next_page_url": "http://example.com/api?page=2",
"path": "http://example.com/api",
"per_page": 15,
"prev_page_url": null,
"to": 15,
"total": 18
},
}
| 参数名 | 类型 | 说明 | 示例 |
|:-------|:-----|:-----|:------|
| id | int | 商品id | 643|
| show_sales | int | 销量 |1111111|
| distance | 浮点 | 距离 | 1887.4 |
| unit | string | 距离单位 | "km" |
| title | string | 商品名称 | "测试商品" |
| show_price | string | 显示价格 | "¥1.00" |
| has_one_exchange_link_goods | obj | 兑换联盟数据 |
| has_one_exchange_link_goods.is_open | int | 是否开启 |
| has_one_exchange_link_goods.title | string | 标题 |
| has_one_exchange_link_goods.carousel | array | 轮播图数组 |