商品
获取商品
请求
- 请求方法:
- 请求URL:
https://domain.com/addons/yun_shop/api.php?route=plugin.third-sync.open.goods
请求参数
示例
{
"i" : 1,
"page" : 1,
"page_size" : 10,
"query": {
"ids": [5],
"not_in_ids": [5],
"title": "测试商品",
"needOptions": true,
"timestamp_range": [
1736438400,
1738252800
]
},
"order_by": {
"id": "asc", // 正序
"created_at": "desc", // 倒叙
},
"body": {
"str_no": "mRJ8XG1oYImszwkODs4mecHdqyuRUmp7",
"source": "dch-xfh",
"timestamp": "1737017595"
},
"sign_type": "MD5",
"sign": "c09534ebc577a05fddcefd3edde8da65"
}
参数解析
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| i | int | 是 | 站点唯一值 |
| page | int | 否 | 当前分页值 |
| page_size | int | 否 | 当前分页数量 (默认10) |
| query | object | 否 | 查询 |
| order_by | object | 否 | 排序 |
| body | object | 是 | 只加签body里面的参数 |
| sign_type | string | 是 | 固定值 'MD5' |
| sign | string | 是 | 验签参数 |
query
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| needOptions | bool | 否 | 是否展示商品规格 |
| title | string | 否 | 商品名称 |
| ids | array(int) | 否 | id数组集合 |
| not_in_ids | array(int) | 否 | id数组集合 |
| timestamp_range | array | 否 | 按照创建时间范围搜索 (时间使用秒级时间戳) |
order_by
注: asc 正序, desc 倒序
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| id | string | 否 | 商品ID |
| created_at | string | 否 | 创建时间 |
| display_order | string | 否 | 原排序字段 |
| price | string | 否 | 现价 |
| cost_price | string | 否 | 成本价 |
| market_price | string | 否 | 市场价 |
body
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| str_no | string | 是 | 随机字符串32位之内, 数字 + 大小写字母组合 |
| source | string | 是 | 来源,由提供方发放的标识 |
| timestamp | int | 是 | 时间戳 |
响应和参数
- 响应格式:
application/json
示例
{
"result": 1,
"msg": "ok",
"data": {
"current_page": 1,
"data": [
{
"id": 5,
"uniacid": 1,
"status": 1,
"display_order": 100,
"title": "测试商品测试商品测试商品测试商品测试商品测试商品",
"thumb": "http://localhost:8000/static/upload/newimage/2e47887207499205182a44db24d9cd0a.jpg",
"sku": "个",
"description": "",
"goods_sn": "SPBM000000001",
"product_sn": "SPTM000000002",
"market_price": "15.00",
"price": "10.00",
"cost_price": "5.00",
"stock": 9999999,
"reduce_stock_method": 0,
"show_sales": 0,
"real_sales": 33,
"weight": "180.00",
"is_new": 0,
"is_hot": 1,
"is_discount": 0,
"is_recommand": 1,
"is_comment": 0,
"created_at": "2025-01-16 21:28:55",
"updated_at": "2025-01-16 21:31:55",
"plugin_id": 0,
"virtual_sales": 9999999,
"need_address": 0,
"type2": 1,
"alias": "测试商品-商品简称",
"status_name": "上架",
"has_many_options": [
{
"id": 1,
"uniacid": 1,
"goods_id": 5,
"title": "规格值1",
"thumb": "",
"product_price": "15.00",
"market_price": "10.00",
"cost_price": "5.00",
"stock": 9999,
"weight": "0.00",
"display_order": 0,
"specs": "1",
"skuId": "",
"goods_sn": "SPBM00001",
"product_sn": "SPTM00001",
"virtual": 0,
"red_price": "",
"volume": "0.000"
}
]
},
],
"next_page_url": null,
"path": "http://localhost:8000/addons/yun_shop/api.php",
"per_page": 15,
"prev_page_url": null,
"to": 4,
"total": 4
}
}
完整返回主体
| 参数名 | 类型 | 描述 |
|---|---|---|
| result | bool | 结果 0 失败, 1成功 |
| msg | bool | 信息 |
| data | object | 商品分页数据 |
商品分页
| 参数名 | 类型 | 描述 |
|---|---|---|
| current_page | int | 当前页码 |
| per_page | int | 每页条数 |
| data | object | 商品数据 |
| to | int | 当前页返回条数 |
| total | int | 总数量 |
商品数据
| 参数名 | 类型 | 描述 |
|---|---|---|
| id | int | id |
| uniacid | int | 站点唯一值 |
| status | int | 状态 |
| display_order | int | 排序 |
| title | string | 商品全称 |
| thumb | string | 主图地址 |
| sku | string | 单位 个/件/包 |
| description | string | 商品描述 |
| goods_sn | string | 商品编码 |
| product_sn | string | 商品条码 |
| market_price | string(decimal) | 市场价 |
| price | string(decimal) | 现价 |
| cost_price | string(decimal) | 成本价 |
| stock | int | 库存 |
| reduce_stock_method | int | 扣库存方式0下单1付款2永不 |
| show_sales | int | 销量 |
| real_sales | int | 实际销量 |
| weight | string(decimal) | 商品重量 |
| is_new | int | 新上 |
| is_hot | int | 热卖 |
| is_discount | int | 促销 |
| is_recommand | int | 推荐 |
| is_comment | int | 站点唯一值 |
| created_at | datetime | 创建时间 |
| updated_at | datetime | 站点唯一值 |
| plugin_id | int | 插件商品 |
| virtual_sales | int | 虚拟销量 |
| need_address | int | 商品下单是否需要填写地址 |
| type2 | int | 商品类型2 |
| alias | string | 商品简称 |
| status_name | string | 站点唯一值 |
| has_many_options | object(array) | 商品规格 |
商品规格
| 参数名 | 类型 | 描述 |
|---|---|---|
| id | int | id |
| uniacid | int | 站点唯一值 |
| goods_id | int | 商品id |
| title | string | 规格名称 |
| thumb | string | 规格图片 |
| product_price | string(decimal) | 现价 |
| market_price | string(decimal) | 市场价 |
| cost_price | string(decimal) | 成本价 |
| stock | int | 库存 |
| weight | string(decimal) | 重量 |
| display_order | int | 排序 |
| specs | int | 规格值ID组合 |
| skuId | int | |
| goods_sn | string | 商品规格编码 |
| product_sn | string | 商品规格条码 |
| virtual | int | 是否虚拟商品 |
| volume | string(decimal) | 体积 |