简要描述:
- 进入分类页,获取一级分类及相关分类设置
请求域名:
- http://xx.com
请求URL:
GET/route=goods.category.index
旧URL:
GET/route=goods.category.category-home
参数:
返回示例:
正确时返回:
{
result: 1,
msg: "success",
data: {
ads: [
{
id: 3,
uniacid: 9,
slide_name: "1",
link: "1",
thumb: "https://dev4.yunzmall.com/attachment/image/7b1abd211df98b8cd840c53e2eee8291.jpeg",
display_order: 1,
enabled: 1,
created_at: "2020-09-02 11:13:10",
updated_at: "2023-01-10 09:53:33",
deleted_at: null,
small_link: "1"
},
{
id: 5,
uniacid: 9,
slide_name: "ceshi huandengpian",
link: "",
thumb: "https://dev4.yunzmall.com/attachment/image/a5a5c79f68dd6a792709054bdb4aab61.jpg",
display_order: 3,
enabled: 1,
created_at: "2021-07-14 18:34:47",
updated_at: "2021-07-14 18:34:47",
deleted_at: null,
small_link: ""
}
],
set: {
cat_brand: "1",
cat_class: "0",
cat_level: "3",
cat_adv_img: "https://dev4.yunzmall.com/attachment/image/dd4886af0e69984199794e2a18d39e21.jpeg",
cat_adv_url: "/packageG/pages/category_v2/category_v2",
small_cat_adv_url: "/pages/buy/cart_v2/cart_v2",
category_to_option: "1",
cat_adv_img_url: "https://dev4.yunzmall.com/attachment/image/dd4886af0e69984199794e2a18d39e21.jpeg",
web_design_enable: 1
},
category: {
current_page: 1,
data: [
{
id: 84719,
name: "图书",
thumb: "",
adv_img: "",
adv_url: "",
parent_id: 0,
description: null,
display_order: 0,
level: 1,
advimg_pc: "",
advurl_pc: "",
small_adv_url: null,
pc_adv_img: null,
pc_adv_url: null
},
{
id: 84728,
name: "生鲜",
thumb: "",
adv_img: "",
adv_url: "",
parent_id: 0,
description: null,
display_order: 0,
level: 1,
advimg_pc: "",
advurl_pc: "",
small_adv_url: null,
pc_adv_img: null,
pc_adv_url: null
},
],
first_page_url: "https://dev4.yunzmall.com/addons/yun_shop/api.php?page=1",
from: 1,
last_page: 1,
last_page_url: "https://dev4.yunzmall.com/addons/yun_shop/api.php?page=1",
next_page_url: null,
path: "https://dev4.yunzmall.com/addons/yun_shop/api.php",
per_page: 1000,
prev_page_url: null,
to: 79,
total: 79
},
recommend: [
{
id: 85273,
name: "收纳整理",
thumb: "",
adv_img: "",
adv_url: "",
parent_id: 0,
description: null,
display_order: 0,
level: 1,
advimg_pc: "",
advurl_pc: "",
small_adv_url: null,
pc_adv_img: null,
pc_adv_url: null
}
],
member_cart: []
}
}
错误时返回:
{
"result": 0,
"msg": "获取失败"
}
返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
ads | array | 分类广告,与旧接口数据一致 |
category | array | 一级分类信息,与旧接口数据一致 |
category_template | array | (已删除)旧装修数据,新接口已删除该数据返回,前端也不需再兼容旧装修 |
goods_list | array | (已删除)原返回默认分类商品,新接口已删除该数据返回,统一交由接口goods.category.get-goods-list-by-category-id获取 |
member_cart | array | 购物车数据,与旧接口数据一致 |
recommend | array | 推荐分类,隐藏时将返回空数组 |
set | obj | 分类设置,与旧接口数据一致 |
category_module | array | 分类模块,原接口:plugin.decorate.frotend.category-template-four-set.index获取的数据,暂时只有使用分类模板4时会有信息返回,其余时候是空数组 |
备注:
商品统一交由goods.category.get-goods-list-by-category-id获取,前端应根据模板及设置不同按需获取 分类模板1:需要获取显示商品,推荐分类开启取第一个推荐分类去获取,否则取一级分类第一个获取 分类模板2:无需显示商品,不用获取商品 分类模板3:无需显示商品,不用获取商品 分类模板4:需要获取显示商品,推荐分类开启取第一个推荐分类去获取,否则取一级分类第一个获取 分类模板5:只支持小程序,需要获取显示商品,推荐分类开启取第一个推荐分类去获取,否则取第一个一级分类下的第一个二级分类获取
- 更多返回错误代码请看首页的错误代码描述