Skip to content

Merchandise模块概要设计

一级分类操作接口

查询一级分类

接口名: /category1/get
Method: GET
请求:
    id O str 分类id,支持in,gt(e),lt(e),regex查询
    name O string 分类名,支持in,gt(e),lt(e),regex查询
    group_id O group ID,支持in,gt(e),lt(e),regex查询
    status O 状态值,1:删除,2:正常
    projection O list 需要返回的字段列表
    sort O dict 排序
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        'id' M string 分类ID
        'name' M string 分类名称
        'group_id' M int 所属group
        'icon' M int 图标ID
    }]
    pagination  O dict 分页信息
    {
        count: 9638 M   int 总条数
        limit: 200  M   int 每页的条数
        offset: 0   M   int 起始的偏移量
    }

新建一级分类

接口名: /category1/create
Method: POST
请求:
    name M string 分类名称
    group_id M int 所属group
    icon M int 图标ID
    sort_id O int 排序ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 返回创建的一级分类ID

修改一级分类

接口名: /category1/update
Method: POST
请求:
    id M string 一级分类ID
    group_id O int 所属group
    name O string 分类名称
    icon O int 图标ID
    sort_id O int 排序ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

删除一级分类

接口名: /category1/delete
Method: POST
请求:
    id M string 一级分类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

二级分类操作接口

查询二级分类

接口名: /category2/get
Method: GET
请求:
    id O string 分类id group ID,支持in,gt(e),lt(e),regex查询
    upstream_id O string 上级ID,group ID,支持in,gt(e),lt(e),regex查询
    name O string  分类名,id O string 分类id group ID,支持in,gt(e),lt(e),regex查询
    group_id O int  group ID,id O string 分类id group ID,支持in,gt(e),lt(e),regex查询
    status O int   状态值,1:删除,2:正常
    projection O list 需要返回的字段列表
    sort O dict 排序
    skip O int 起始位置
    limit O int 返回数量
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        'id' M string 分类ID
        'name' M string 分类名称
        'group_id' M int 所属group
        'upstream_id' M string 一级分类ID
    }]
    pagination  O dict 分页信息
    {
        count: 9638 M   int 总条数
        limit: 200  M   int 每页的条数
        offset: 0   M   int 起始的偏移量
    }

查询二级分类树

接口名: /category2/tree
Method: GET
请求:
    group_id M int group ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    {
        'A106':{
            'id': 'A106', M string 分类ID
            'icon': 1,  M   int
            'status': 2,    M   int 状态,1:删除 2:正常
            'group_id': 1,  M   int saas group id
            'name': '南北干货', M   string  分类名
            'origin_id': 'A106' M   
            'sub':{
                'B119': {
                    upstream_id: "A103" M   string 上级ID
                    id: "B119"
                    status: 2
                    group_id: 1
                    name: "鲜蛋"
                    origin_id: "B119"
                }
            }
        }
    }

查询二级分类分支

接口名: /category2/branch
Method: GET
请求:
    ids M list 二级id列表
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        upstream_id: "A101" M   string  上级分类ID
        upstream_name: "蔬菜" M   string  上级分类名
        status: 2   M   int 状态,1:删除 2:正常   
        id: "B101"  M   string  分类ID
        group_id: 1 M   int 
        name: "叶菜类"
        origin_id: "B101"
    }]

新建二级分类

接口名: /category2/create
Method: POST
请求:
    name M string 分类名称
    group_id M int 所属group
    upstream_id M string 一级分类ID
    sort_id O int 排序ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 返回创建的二级分类ID

修改二级分类

接口名: /category2/update
Method: POST
请求:
    id M string 二级分类ID
    group_id O int 所属group
    name O string 分类名称
    upstream_id M string 一级分类ID
    sort_id O int 排序ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

删除二级分类

接口名: /category2/delete
Method: POST
请求:
    id M string 二级分类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

品类操作接口

查询品类

接口名: /pinlei/get
Method: GET
请求:
    id O string 分类id,支持in,gt(e),lt(e),regex查询
    upstream_id O string 上级ID,支持in,gt(e),lt(e),regex查询
    name O string 分类名,支持in,gt(e),lt(e),regex查询
    group_id O int group ID,支持in,gt(e),lt(e),regex查询
    status O int 状态值,1:删除,2:正常
    projection O list 需要返回的字段列表
    sort O dict 排序
    skip    O   int 起始位置
    limit   O   int 返回数量 
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        'id' M string 品类ID
        'name' M string 品类名称
        'group_id' M int 所属group
        'upstream_id' M string 二级分类ID
    }]
    pagination  O   dict    分页信息
    {
        count: 9638 M   int 总条数
        limit: 200  M   int 每页的条数
        offset: 0   M   int 起始的偏移量
    }

查询品类分支

接口名: /pinlei/branch
Method: GET
请求:
    ids M list 品类id列表
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        upstream_id: "B101"
        id: "P00001"
        upstream_name: "叶菜类"
        status: 2
        category1_name: "蔬菜"
        group_id: 1
        name: "菜心"
        origin_id: "P00001"
        category_id_1: "A101"
    }]

新建品类

接口名: /pinlei/create
Method: POST
请求:
    name M string 品类名称
    group_id M int 所属group
    upstream_id M string 二级分类ID
    sort_id O int 排序ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 返回创建的品类ID

修改品类

接口名: /pinlei/update
Method: POST
请求:
    id M string 品类ID
    group_id M int 所属group
    name O string 品类名称
    upstream_id M string 二级分类ID
    sort_id O int 排序ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

删除品类

接口名: /pinlei/delete
Method: POST
请求:
    id M string 品类ID
    group_id M int 所属group
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

spu操作接口

查询spu

接口名: /spu/get
Method: GET
请求:
    id O string  spu id,支持in,gt(e),lt(e),regex查询
    name O string  分类名,支持in,gt(e),lt(e),regex查询
    category_id_1 O string 一级分类ID,支持in,gt(e),lt(e),regex查询
    category_id_2 O string 二级分类ID,支持in,gt(e),lt(e),regex查询
    pinlei_id O string 品类ID,支持in,gt(e),lt(e),regex查询
    group_id O string group ID,支持in,gt(e),lt(e),regex查询
    station_id O string 站点ID,支持in,gt(e),lt(e),regex查询
    status O int 状态值,1:删除,2:正常
    p_type O int 类型,1:通用/2:私有
    or O list or查询,形如[{"group_id":54}],参数类型要求同上,or查询内支持的操作符也同上,形如:[{"group_id":{"$in":[54]}}]
    projection O list 需要返回的字段列表
    sort O dict 排序
    limit O int 限制个数
    offset O int 偏移个数
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        'pinlei_id' M string 品类ID
        'id' M string spu ID
        'name' M string spu名称
        'desc' M string 描述
        'p_type' M string spu类型
        'image' M string 图片
        'group_id' M int 所属group
        'station_id' O string 所属站点ID
        'dispatch_method' M string 分拣方式
        'std_unit_name' O string 基本单位
        'alias' O list 别名
    }]
    pagination  O   dict    分页信息
    {
        count: 9638 M   int 总条数
        limit: 200  M   int 每页的条数
        offset: 0   M   int 起始的偏移量
    }

查询spu分支

接口名: /spu/branch
Method: GET
请求:
    ids    M   list  spu id列表
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M list 返回的数据列表
    [{
        pinlei_name: "菜苔"
        category1_name: "蔬菜"
        desc: "-"
        name: "白菜苔"
        group_id: 1
        category_id_1: "A101"
        p_type: 0
        category2_name: "叶菜类"
        dispatch_method: 2
        pinlei_id: "P00006"
        std_unit_name: "斤"
        id: "C00001"
        category_id_2: "B101"
        status: 2
        image: "f43b8093de95310f.jpg"
    }]

新建spu

接口名: /spu/create
Method: POST
请求:
    name M string spu名称
    desc M string spu描述
    p_type M int 类型(0:通用;1:私有)
    std_unit_name M string 基本单位
    image M string 图片名称
    dispatch_method M int 分拣方式(1:bagua/2:union)
    pinlei_id M string 品类ID
    group_id M int 所属group
    station_id O string 所属站点ID
    alias O list spu别名
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 返回创建的spu ID

修改spu

接口名: /spu/update
Method: POST
请求:
    id M string spu ID
    group_id M int 所属group
    station_id M string 所属站点ID
    name O string spu名称
    desc O string spu描述
    p_type O int 类型(0:通用;1:私有)
    std_unit_name O string 基本单位
    image O string 图片名称
    dispatch_method O int 分拣方式(1:bagua/2:union)
    pinlei_id O string 品类ID
    status  O   int   状态值
    alias O list spu别名
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

删除spu

接口名: /spu/delete
Method: POST
请求:
    id M string spu ID
    group_id M int 所属group
    station_id M string 所属站点ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息