简要描述:

  • 商品搜索

请求域名:

  • http://xx.com

请求URL:

GET:route=plugin.fight-groups.admin.controllers.fight-groups.search-goods

参数:

参数名 是否必须 类型 说明
category int 分类id
goods_name string 商品名称

返回示例:

正确时返回:

{
    "result":1,
    "msg":"成功",
    "data":{
        "total":96,
        "per_page":10,
        "current_page":1,
        "last_page":10,
        "next_page_url":"http://www.yz.com/web/index.php?page=2",
        "prev_page_url":null,
        "from":1,
        "to":10,
        "data":[
            {
                "id":254,
                "uniacid":2,
                "brand_id":1,
                "type":1,
                "status":1,
                "display_order":8888878,
                "title":"经销商等级测试",
                "thumb":"http://www.yz.com/attachment/images/2/2018/12/OeVQYZiYwgImwDmV5uTIUReYZaz2eu.jpg",
                "thumb_url":[
                    "http://www.yz.com/attachment/images/2/2019/01/nMISoeijZz1Imue44e2RNeunobMnj2.jpg",
                    "http://www.yz.com/attachment/images/2/2019/01/vBJ2Qj2JqkQ5qZkQ5TQFKrR225hQQz.jpg",
                    "http://www.yz.com/attachment/images/2/2019/01/htPd9U6u9egdgAqZp964zge7e4mdP3.jpg"
                ],
                "sku":"23",
                "description":"",
                "content":"",
                "goods_sn":"",
                "product_sn":"",
                "market_price":"0.01",
                "price":"0.01",
                "cost_price":"0.01",
                "stock":2,
                "reduce_stock_method":0,
                "show_sales":0,
                "real_sales":0,
                "weight":"1.00",
                "has_option":1,
                "is_new":1,
                "is_hot":0,
                "is_discount":0,
                "is_recommand":0,
                "is_comment":0,
                "is_deleted":0,
                "created_at":"2018-12-12 09:33:37",
                "deleted_at":null,
                "updated_at":"2019-01-31 18:00:58",
                "comment_num":0,
                "is_plugin":0,
                "plugin_id":0,
                "virtual_sales":12,
                "no_refund":0,
                "need_address":0,
                "type2":1,
                "has_many_activity_goods_count":1,
                "status_name":"上架",
                "has_many_options":[
                    {
                        "id":363,
                        "goods_id":254,
                        "title":"红色+24寸",
                        "thumb":"",
                        "product_price":"1101.00",
                        "market_price":"1001.00",
                        "cost_price":"0.00",
                        "stock":101,
                        "specs":"242_263"
                    },
                    {
                        "id":364,
                        "goods_id":254,
                        "title":"红色+32寸",
                        "thumb":"",
                        "product_price":"1102.00",
                        "market_price":"1002.00",
                        "cost_price":"0.00",
                        "stock":102,
                        "specs":"242_264"
                    },
                    {
                        "id":365,
                        "goods_id":254,
                        "title":"黄色+24寸",
                        "thumb":"",
                        "product_price":"1103.00",
                        "market_price":"1003.00",
                        "cost_price":"0.00",
                        "stock":103,
                        "specs":"259_263"
                    },
                    {
                        "id":366,
                        "goods_id":254,
                        "title":"黄色+32寸",
                        "thumb":"",
                        "product_price":"1104.00",
                        "market_price":"1004.00",
                        "cost_price":"0.00",
                        "stock":104,
                        "specs":"259_264"
                    }
                ]
            },
            {
                "id":113,
                "uniacid":2,
                "brand_id":0,
                "type":2,
                "status":1,
                "display_order":111111,
                "title":"经销商商品测试.4",
                "thumb":"http://www.yz.com/attachment/images/2/2018/08/L8Ia553RrZH83rEiLocYIY3L9o5885.jpg",
                "thumb_url":[
                    "http://www.yz.com/attachment/images/2/2018/08/L8Ia553RrZH83rEiLocYIY3L9o5885.jpg"
                ],
                "sku":"个",
                "description":"",
                "content":"<p><iframe frameborder="0" src="https://v.qq.com/txp/iframe/player.html?vid=o0761iov2tf" allowfullscreen="true"></iframe></p>",
                "goods_sn":"",
                "product_sn":"",
                "market_price":"1.00",
                "price":"100.00",
                "cost_price":"20.00",
                "stock":1018,
                "reduce_stock_method":0,
                "show_sales":93,
                "real_sales":93,
                "weight":"1.00",
                "has_option":0,
                "is_new":0,
                "is_hot":0,
                "is_discount":0,
                "is_recommand":0,
                "is_comment":0,
                "is_deleted":0,
                "created_at":"2018-09-12 17:42:54",
                "deleted_at":null,
                "updated_at":"2018-12-12 10:28:51",
                "comment_num":1,
                "is_plugin":0,
                "plugin_id":0,
                "virtual_sales":11,
                "no_refund":0,
                "need_address":0,
                "type2":1,
                "has_many_activity_goods_count":0,
                "status_name":"上架",
                "has_many_options":[

                ]
            },
        ],
        "category":null,
        "goods_name":null
    }
}

返回参数说明:

参数名 类型 说明
total int 搜索总记录数
per_page int 每页记录数
current_page int 当前页数
last_page int 最后页数
data array 商品列表
category int 搜索的分类id
goods_name string 搜索的商品标题

返回data参数说明:

data 参数名 类型 说明
id int 商品id
title string 商品名称
thumb string 图片地址
price float 价格
stock int 库存
sku string 单位
has_many_options array 商品规格信息
has_many_activity_goods_count int 该商品正在活动的数量,当该字段大于0时,商品不可选择
has_many_options 参数名 类型 说明
id int 商品规格id
title string 商品规格名称
thumb string 图片地址
product_price float 销售价格
stock int 库存

备注:

当has_many_options没有数据时,说明商品没有规格,这时候的库存取商品的stock库存,原价取商品的price价格。当has_many_options有数据时,价格取规格中的product_price销售价格,库存取规格中的stock库存