Skip to content

常用

常用

常用列表保存收藏的spu_id,需要根据当前店铺的销售单获取有效的商品数量
存储 在redis中 key: 'favs_more_sid_' + address_id
数据结构 [{'id': id, 'name': 'xxx', 'list': []}] 
字段 id:1-5的数字 name:不重复的字符 list: spu_ids列表
限制 每个店铺最多有5个列表 至少有一个名为'常用列表1'的常用列表

/favorite/list/get 获取常用列表

接口名: /favorite/list/get
Method: GET
请求:
    无
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data O list 成功时常用列表信息,json格式
    [{
        id M int 常用列表ID
        name M string 常用列表名称
        count M int 列表中商品数量
        list M list 常用列表中spu_ids
        [
            spu_id M string spu ID
        [
    }]
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/get
    response:
    {
        msg: "ok",
        data: [{
            count: 4,
            list: [
                "C00001",
                "C00004",
                "C00003",
                "C00005"
            ],
            name: "11",
            id: 2
        }],
        code: 0
    }

/favorite/list/add 增加常用列表

接口名: /favorite/list/add
Method: POST
请求:
    name M string 列表名
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data O list 成功时常用列表信息,json格式
    [{
        id M int 常用列表ID
        name M string 常用列表名称
        count M int 列表中商品数量
        list M list 常用列表中spu_ids
        [
            spu_id M string spu ID
        [
    }]
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/add
    response:
    {
        msg: "ok",
        data: [{
            count: 0,
            list: [],
            name: "测试",
            id: 2
        }],
        code: 0
    }

/favorite/list/delete 删除常用列表

接口名: /favorite/list/delete
Method: POST
请求:
    id M int 列表id
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data O list 成功时常用列表信息,json格式
    [{
        id M int 常用列表ID
        name M string 常用列表名称
        count M int 列表中商品数量
        list M list 常用列表中spu_ids
        [
            spu_id M string spu ID
        [
    }]
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/delete
    response:
    {
        msg: "ok",
        data: [{
            count: 4,
            list: ["C00003", "C00001", "C32549", "C00232"],
            name: "测试",
            id: 2
        }],
        code: 0
    }

/favorite/list/rename 重命名常用列表

接口名: /favorite/list/rename
Method: POST
请求:
    id M int 列表id
    name M string 新列表名
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data O list 成功时常用列表信息,json格式
    [{
        id M int 常用列表ID
        name M string 常用列表名称
        count M int 列表中商品数量
        list M list 常用列表中spu_ids
        [
            spu_id M string spu ID
        [
    }]
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/rename
    response:
    {
        msg: "ok",
        data: [{
            count: 4,
            list: ["C00003", "C00001", "C32549", "C00232"],
            name: "新名称",
            id: 2
        }],
        code: 0
    }

/favorite/list/detail 获取列表详情 商品信息

接口名: /favorite/list/detail
Method: GET
请求:
    id M int 列表id
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data O dict 成功时列表商品详细信息,json格式
    {
        name M string 常用列表名称
        products M list 商品信息列表
        [{
            img_url: spu图片链接,
            id: spu_id,
            name: spu名称,
            is_fav: 是否已收藏,
            std_unit_name: 基本单位,
            std_sale_price: 售卖价格,
            cart_amount: 加入购物车数量,
            skus: [{
                name: sku名称,
                sale_unit_name: 售卖单位,
                std_sale_price: 基本单位价格,
                sale_ratio: 换算率(售卖单位/基本单位),
                img_url: sku图片链接,
                sale_num_least: 最小下单数量,
                state: 上架状态(1:上架;0:下架),
                category_id_1: 一级分类ID,
                sale_price: 售卖价格,
                is_valid: 是否有效(在用户的销售单内),
                rule_price: 规则价格,
                desc: 描述,
                id: sku_id,
                search_key: 搜索的二级分类ID 前端用,
                std_unit_name: 基本单位,
                category_id_2: 二级分类ID,
                stocks: 库存数量,
                station_id: 站点ID,
                cart_amount: 加入采购单数量,
                salemenu_id: 销售单ID,
                spu_id: spu_id,
                sort_id: 排序ID(给有排序需求的站点使用)
            }],
            salemenu_id: 销售单ID,
            sort_id: 排序ID(给有排序需求的站点使用)
        }]
    }
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/detail
    response:
    {
        data: {
            products: [{
                std_sale_price: 1110,
                is_fav: true,
                salemenu_id: "S0599",
                id: "C00232",
                name: "鲜大肠",
                sort_id: 0,
                skus: [{
                    category_id_2: "B111",
                    desc: "已清洗,带少量水,按实际斤两结算",
                    std_unit_name: "斤",
                    cart_amount: 0,
                    sale_ratio: 1,
                    category_id_1: "A102",
                    salemenu_id: "S0599",
                    sale_num_least: 1,
                    std_sale_price: 1110,
                    sale_unit_name: "斤",
                    station_id: "T208",
                    img_url: "https://bshop.guanmai.cn/static/productpic/1accd830326b7da2.jpg",
                    sort_id: 0,
                    sale_price: 1110,
                    stocks: -99999,
                    id: "D949120",
                    is_valid: true,
                    spu_id: "C00232",
                    name: "鲜大肠|斤",
                    state: 1,
                    rule_price: null
                }],
                std_unit_name: "斤",
                cart_amount: 0,
                img_url: "https://bshop.guanmai.cn/static/productpic/1accd830326b7da2.jpg"
            }],
            name: "新名称"
        },
        msg: "ok",
        code: 0
    }

/favorite/list/update 更新列表商品 排序使用

接口名: /favorite/list/update
Method: POST
请求:
    list_id M int 列表id
    spu_ids M list 已排序的spu id列表
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 出错信息提示
    data M dict 成功时返回常用列表信息,json格式
    {
        id M int 常用列表ID
        name M string 常用列表名称
        list M list 常用列表中spu_ids
        [
            spu_id M string spu ID
        [
    }
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/update
        list_id 3
        spu_ids ["C00003", "C32549", "C00001", "C00232"]
    response:
    {
        msg: "ok",
        data: {
            count: 4,
            list: ["C00003", "C32549", "C00001", "C00232"],
            name: "新名称",
            id: 3
        },
        code: 0
    }

/favorite/detail/update 更新商品收藏 将某商品加入常用列表

接口名: /favorite/detail/update
Method: POST
请求:
    list_ids M list 列表id
    spu_id M string spu id列表
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data M list 成功时常用列表信息,json格式
    [{
        id M int 常用列表ID
        name M string 常用列表名称
        list M list 常用列表中spu_ids
        [
            spu_id M string spu ID
        [
    }]
示例:
    request:
        http://testbshop.guanmai.cn/favorite/detail/update
        list_ids [3]
        spu_id "C00003"
    response:
    {
        msg: "ok",
        data: [{
            count: 4,
            list: ["C00003", "C32549", "C00001", "C00232"],
            name: "新名称",
            id: 3
        }],
        code: 0
    }

/favorite/detail/delete 取消商品收藏 将某商品从常用列表中删除

接口名: /favorite/detail/delete
Method: POST
请求:
    list_id M int 列表id
    spu_id M string spu id
响应:
    code M int 返回码 0为成功、其他为错误
    msg M string 信息提示
    data M string 删除的spu id
示例:
    request:
        http://testbshop.guanmai.cn/favorite/list/delete
        list_id 3
        spu_id C00003
    response:
    {
        msg: "ok",
        data: "C00003",
        code: 0
    }