Skip to content

商品库模版接口

商品库模版接口

模板一级分类

/template/category1/get 查询模板一级分类

Method: GET
请求:
    id O str 分类id,支持in,gt(e),lt(e),regex查询
    name O string 分类名,支持in,gt(e),lt(e),regex查询
    pstatus O 状态值,1:删除,2:正常
    projection O list 需要返回的字段列表

响应:
    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
    }]

/template/category1/create 创建模板一级分类

Method: POST
请求:
    name M string 一级分类名
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 一级分类ID
逻辑:
    验证分类名是否存在
    创建一级分类

/template/category1/update 修改模板一级分类

Method: POST
请求:
    id M string 一级分类ID
    name O string 一级分类名
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断指定的一级分类ID是否存在
    验证待修改的一级分类名是否重复
    修改一级分类信息

/template/category1/delete 删除模板一级分类

Method: POST
请求:
    id M string 一级分类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断指定的一级分类ID是否存在
    设置分类状态为删除

模板二级分类

/template/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查询
    pstatus O int   状态值,1:删除,2:正常
    projection O list 需要返回的字段列表

响应:
    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
    }]

/template/category2/create 创建模板二级分类

Method: POST
请求:
    name M string 二级分类名
    upstream_id M string 一级分类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 返回创建的二级分类ID
逻辑:
    判断一级分类ID是否存在
    验证二级分类名是否存在
    创建指定一级分类ID下的二级分类

/template/category2/update 更新模板二级分类

Method: POST
请求:
    id M string 二级分类ID
    name O string 二级分类名
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断二级分类ID是否存在
    验证待修改的二级分类名是否重复
    验证待修改的一级分类ID是否有效
    更新二级分类信息

/template/category2/delete 删除模板二级分类

Method: POST
请求:
    id M string 二级分类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断二级分类ID是否存在
    设置二级分类状态为删除

模板品类

/template/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查询
    pstatus O int 状态值,1:删除,2:正常
    projection O list 需要返回的字段列表
响应:
    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
    }]

/template/pinlei/create 创建模板品类

Method: POST
请求:
    name M string 品类名称
    upstream_id M string 二级分类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string 品类ID
逻辑:
    判断二级分类ID是否存在
    验证品类名是否重复
    创建指定二级分类ID下的品类

/template/pinlei/update 更新模板品类

Method: POST
请求:
    id M string 品类ID
    name M string 品类名称
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断品类ID是否存在
    验证待修改的品类名是否重复
    更新品类信息

/template/pinlei/delete 删除模板品类

Method: POST
请求:
    id M string 品类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断品类ID是否存在
    设置品类状态为删除

模板SPU

/template/spu/get 获取spu模板

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
        'category_id_2' M string 二级分类ID
        'category_id_1' 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 起始的偏移量
    }

/template/spu/create 创建spu模板

Method: POST
请求:
    name M string spu名称
    desc O string spu描述
    std_unit_name M string 基本单位
    image O string 图片名称
    pinlei_id M string 品类ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M string spu ID
逻辑:
    判断用户是否能创建对应类型的spu
    判断品类ID是否有效
    判断是否重复
    创建spu

/template/spu/update 更新spu模板

Method: POST
请求:
    spu_id M string spuID
    name O string spu名称
    desc O string spu描述
    image O string 图片名称
    pinlei_id O string 品类ID
    is_active O int 状态 0:有效 1:无效
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
逻辑:
    判断用户是否能修改对应类型的spu
    判断spu ID是否有效
    判断是否重复
    修改spu信息

/template/spu/delete 删除spu模板

Method: POST
请求:
    id M string spuID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息

/template/spu/detail spu模板详情

Method: GET
请求:
    id M string spu模板ID
响应:
    code M int 0为成功,其它为失败
    msg M string 错误提示信息
    data M dict 返回的商品信息    
    {
        "desc":"",              # 商品描述
        "name":"苹果",            # 商品名称
        "id":"C920973",         # 云商品ID
        "std_unit_name":"斤",    # 基本单位
        "images":["http://testpic.guanmai.cn/pic/bc3d.png"],    # 商品图片列表, 可能不存在图片
        "category_id_1":"A21321",   # 商品一级分类
        "category_name_1":"水果",
        "category_id_2":"B21012",
        "category_name_2":"进口水果",
        "pinlei_id":"P350044",
        "pinlei_name":"进口香蕉",
        "is_active": 0,  #状态 0:有效 1:无效
    }