简要描述:

  • 商品分类接口,由于页面的改版,需要增加商品显示 1.进入分类首页即加载推荐分类以及一级分类,并且显示第一个推荐分类的商品 2.点击一级分类,加载二级分类和三级分类(如果开启三级分类),并且显示第一个二级分类的商品(如果开启三级分类,则显示第一个二级分类的第一个三级分类下的商品) 3.会员点击一个二级分类或三级分类,加载该分类下的商品 4.商品数据分页,获取下一页的商品数据需要请求goods.category.get-goods-list-by-category-id接口获取商品数据 5.增加购物车信息

请求域名:

  • http://yunzshop.com

请求URL:

POST/app/index.php?i=1&c=entry&do=shop&m=yun_shop&route=goods.category.category-home

参数:

参数名 是否必须 类型 说明
parent_id int 父类ID
page int 页码数

返回示例:

正确时返回:

 {
    "result":1,
    "msg":"获取分类数据成功!",
    "data":{
        "category":{
            "total":4,
            "per_page":100,
            "current_page":1,
            "last_page":1,
            "next_page_url":null,
            "prev_page_url":null,
            "from":1,
            "to":4,
            "data":[
                {
                    "id":146,
                    "uniacid":10,
                    "name":"1",
                    "thumb":"https://dev-1251768088.cos.ap-guangzhou.myqcloud.com/images/10/2018/12/aA1155eye14UZ138FN1ZV1v1z33V3W.jpg",
                    "parent_id":0,
                    "description":"",
                    "display_order":0,
                    "enabled":1,
                    "is_home":1,
                    "adv_img":"",
                    "adv_url":"",
                    "level":1,
                    "advimg_pc":"",
                    "advurl_pc":"",
                    "created_at":"2018-12-13 15:07:33",
                    "updated_at":"2018-12-29 18:26:14",
                    "deleted_at":null,
                    "plugin_id":0,
                    "filter_ids":null
                }
            ]
        },
        "recommend":[
            {
                "id":146,
                "uniacid":10,
                "name":"1",
                "thumb":"https://dev-1251768088.cos.ap-guangzhou.myqcloud.com/images/10/2018/12/aA1155eye14UZ138FN1ZV1v1z33V3W.jpg",
                "parent_id":0,
                "description":"",
                "display_order":0,
                "enabled":1,
                "is_home":1,
                "adv_img":"",
                "adv_url":"",
                "level":1,
                "advimg_pc":"",
                "advurl_pc":"",
                "created_at":"2018-12-13 15:07:33",
                "updated_at":"2018-12-29 18:26:14",
                "deleted_at":null,
                "plugin_id":0,
                "filter_ids":null
            }
        ],
		"member_cart":[
            {
                "id":399,
                "goods_id":539,
                "total":1,
                "option_id":0,
                "created_at":"2019-08-06 17:39:15",
                "updated_at":"2019-08-06 17:39:15",
                "deleted_at":null,
                "plugin_id":0,
                "goods":{
                    "id":539,
                    "thumb":"https://dev-1251768088.cos.ap-guangzhou.myqcloud.com/images/12/2018/12/hVsiSftuwC5FtIFu5UuPsDDFdrOdoe.png",
                    "price":"10.00",
                    "market_price":"120.00",
                    "title":"测试商品",
                    "deleted_at":null,
                    "vip_price":"10.00",
                    "has_many_goods_discount":[
                        {
                            "id":18279,
                            "goods_id":539,
                            "level_discount_type":1,
                            "discount_method":1,
                            "level_id":0,
                            "discount_value":"0.00",
                            "created_at":"2019-05-29 13:40:31",
                            "updated_at":"2019-05-29 13:40:31",
                            "deleted_at":null
                        },
                        {
                            "id":18280,
                            "goods_id":539,
                            "level_discount_type":1,
                            "discount_method":1,
                            "level_id":16,
                            "discount_value":"0.00",
                            "created_at":"2019-05-29 13:40:31",
                            "updated_at":"2019-05-29 13:40:31",
                            "deleted_at":null
                        }
                    ]
                },
                "goods_option":null,
                "option_str":""
            }
        ],
        "goods_list":{
            "total":33,
            "per_page":20,
            "current_page":1,
            "last_page":2,
            "next_page_url":"https://dev7.yunzmall.com/addons/yun_shop/api.php?page=2",
            "prev_page_url":null,
            "from":1,
            "to":20,
            "data":[
                {
                    "id":653,
                    "uniacid":10,
                    "brand_id":0,
                    "type":1,
                    "status":1,
                    "display_order":0,
                    "title":"经销商提成",
                    "thumb":"https://dev-1251768088.cos.ap-guangzhou.myqcloud.com/images/10/2019/01/MST663zBsTfBZ9ttT939b99Uu9pft9.jpg",
                    "thumb_url":"a:1:{i:0;s:52:"images/10/2019/01/MST663zBsTfBZ9ttT939b99Uu9pft9.jpg";}",
                    "sku":"1",
                    "description":"",
                    "content":"",
                    "goods_sn":"",
                    "product_sn":"",
                    "market_price":"200.00",
                    "price":"100.00",
                    "cost_price":"10.00",
                    "stock":91,
                    "reduce_stock_method":0,
                    "show_sales":20,
                    "real_sales":20,
                    "weight":"0.00",
                    "has_option":0,
                    "is_new":0,
                    "is_hot":0,
                    "is_discount":0,
                    "is_recommand":0,
                    "is_comment":0,
                    "is_deleted":0,
                    "created_at":"2019-05-24 17:10:17",
                    "deleted_at":null,
                    "updated_at":"2019-07-04 14:05:50",
                    "comment_num":0,
                    "is_plugin":0,
                    "plugin_id":0,
                    "virtual_sales":1,
                    "goods_video":"",
                    "no_refund":0,
                    "need_address":0,
                    "type2":1,
                    "goods_category_id":2281,
                    "goods_id":653,
                    "category_id":147,
                    "category_ids":"146,147",
                    "buyNum":0,
                    "status_name":"上架",
                    "has_many_specs":[
                        {
                            "id":161,
                            "goods_id":653,
                            "title":"12",
                            "description":null,
                            "has_many_specs_item":[
                                {
                                    "id":465,
                                    "title":"13",
                                    "specid":161,
                                    "thumb":""
                                },
                                {
                                    "id":466,
                                    "title":"14",
                                    "specid":161,
                                    "thumb":""
                                }
                            ]
                        },
                        {
                            "id":162,
                            "goods_id":653,
                            "title":"13",
                            "description":null,
                            "has_many_specs_item":[
                                {
                                    "id":467,
                                    "title":"14",
                                    "specid":162,
                                    "thumb":""
                                },
                                {
                                    "id":468,
                                    "title":"15",
                                    "specid":162,
                                    "thumb":""
                                }
                            ]
                        }
                    ],
                    "has_many_options":[
                        {
                            "id":587,
                            "goods_id":653,
                            "title":"13+14",
                            "thumb":"",
                            "product_price":"80.00",
                            "market_price":"300.00",
                            "stock":5,
                            "specs":"465_467",
                            "weight":"0.00"
                        },
                        {
                            "id":588,
                            "goods_id":653,
                            "title":"13+15",
                            "thumb":"",
                            "product_price":"70.00",
                            "market_price":"300.00",
                            "stock":10,
                            "specs":"465_468",
                            "weight":"0.00"
                        },
                        {
                            "id":589,
                            "goods_id":653,
                            "title":"14+14",
                            "thumb":"",
                            "product_price":"50.00",
                            "market_price":"300.00",
                            "stock":11,
                            "specs":"466_467",
                            "weight":"0.00"
                        },
                        {
                            "id":590,
                            "goods_id":653,
                            "title":"14+15",
                            "thumb":"",
                            "product_price":"60.00",
                            "market_price":"300.00",
                            "stock":11,
                            "specs":"466_468",
                            "weight":"0.00"
                        }
                    ]
                }
            ]
        },
        "ads":[
            {
                "id":6,
                "uniacid":10,
                "slide_name":"1",
                "link":"",
                "thumb":"https://dev-1251768088.cos.ap-guangzhou.myqcloud.com/images/10/2018/12/jtkSNfSISuuWWHP03sS7kzuhP1onk9.png",
                "display_order":0,
                "enabled":1,
                "created_at":"2018-12-14 09:15:27",
                "updated_at":"2018-12-14 09:15:27",
                "deleted_at":null
            }
        ],
        "set":{
            "cat_level":"2",
            "cat_adv_img":"",
            "cat_adv_url":""
        },

    }
}

错误时返回:

{
    "result":0,
    "msg":"未检测到分类数据!",
    "data":{}
}

返回category分类列表参数说明:

参数名 类型 说明
total int 分类总条数
per_page int 每页条数
current_page int 当前页码
last_page int 最后一页的页码 URL
next_page_url string 下一页URL
prev_page_url string 上一页URL
from int 第几条开始
to int 第几条结束
data json 分类数据
:----- :----- -----
分类数据
参数名 类型 说明
id int id
uniacid int uniacid
name string 分类名
thumb string 图片
parent_id int 父类ID
description string 分类描述
display_order int 排序
enabled int 是否显示 0:否 1:是
is_home int 是否推荐 0:不推荐 1:推荐
adv_img string 移动端分类广告图片
adv_url string 分类广告链接
level int 分类级别
advimg_pc string PC端分类广告图片
advurl_pc string PC分类广告链接

返回member_cart购物车数据参数说明:

参数名 类型 说明
id int 购物车id
goods_id string 商品id
total int 总数
goods object 商品列表
:----- :----- -----
goods商品列表数据
id int 商品ID
title string 商品标题
thumb string 商品缩略图
vip_price decimal vip价格
price decimal 价格
market_price decimal 原价
has_many_goods_discount array 抵扣信息列表
:----- :----- -----
has_many_goods_discount抵扣信息列表

返回goods_list商品分页数据参数说明:

参数名 类型 说明
total int 分类总条数
per_page int 每页条数
current_page int 当前页码
last_page int 最后一页的页码 URL
next_page_url string 下一页URL
prev_page_url string 上一页URL
from int 第几条开始
to int 第几条结束
data json 商品列表数据
:----- :----- -----
商品列表数据
id int 商品ID
uniacid int 店铺ID
brand_id int 品牌ID
type int 商品类型: 1为实体,2为虚拟
status int 商品状态: 1上架,0下架
title string 商品标题
thumb string 商品图片完整路径
thumb_url array 其它商品图片完整路径
sku string 商品单位(个、台、件等)
description string 商品描述
content string 商品详情
goods_sn string 商品编号
product_sn string 商品条码
market_price float 商品市场价(元)
price float 商品金额(元)
stock int 库存
show_sales int 销量
weight float 重量
has_option int 是否有规格 1是 0否
is_course int 是否是课程 0 不是 1是
is_new int 是否新上
is_hot int 是否热卖
is_discount int 是否促销
is_recommand int 是否推荐
is_comment int 是否允许评论
min_price float 最小价格,只在有规格时出现
max_price float 最大价格,只在有规格时出现
goods_type int 0-普通商品 1-门店商品 2-课程商品

返回recommend推荐分类参数说明:

参数名 类型 说明
id int id
uniacid int uniacid
name string 分类名
thumb string 图片
parent_id int 父类ID
description string 分类描述
display_order int 排序
enabled int 是否显示 0:否 1:是
is_home int 是否推荐 0:不推荐 1:推荐
adv_img string 移动端分类广告图片
adv_url string 分类广告链接
level int 分类级别
advimg_pc string PC端分类广告图片
advurl_pc string PC分类广告链接

返回set分类设置参数说明:

参数名 类型 说明
cat_adv_img string 推荐分类广告图片
cat_adv_url string 推荐分类广告连接
cat_level int 分类级别

备注:

  • 更多返回错误代码请看首页的错误代码描述