云商品库管理
Admin云商品库管理
一级分类
/merchandise/template/category1/create 创建一级分类
Method: POST
请求:
name M string 一级分类名
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
data M string 一级分类ID
逻辑:
验证分类名是否存在
创建一级分类
/merchandise/template/category1/update 修改一级分类
Method: POST
请求:
id M string 一级分类ID
name O string 一级分类名
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
逻辑:
判断指定的一级分类ID是否存在
验证待修改的一级分类名是否重复
修改一级分类信息
/merchandise/template/category1/delete 删除一级分类
Method: POST
请求:
id M string 一级分类ID
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
逻辑:
判断指定的一级分类ID是否存在
设置分类状态为删除
/merchandise/template/category1/get 获取一级分类信息
Method: GET
请求:
无
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
data M list 返回的分类信息
[{
'id' M string 分类ID
'name' M string 分类名
"rank" M 0 排列顺序
}]
逻辑:
获取一级分类
返回一级分类信息列表
二级分类
/merchandise/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下的二级分类
/merchandise/template/category2/update 更新二级分类
Method: POST
请求:
id M string 二级分类ID
name O string 二级分类名
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
逻辑:
判断二级分类ID是否存在
验证待修改的二级分类名是否重复
验证待修改的一级分类ID是否有效
更新二级分类信息
/merchandise/template/category2/delete 删除二级分类
Method: POST
请求:
id M string 二级分类ID
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
逻辑:
判断二级分类ID是否存在
设置二级分类状态为删除
/merchandise/template/category2/get 获取二级分类信息
Method: GET
请求:
upstream_id O string 上游ID
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
data M list 返回的分类信息
[{
'id' M string 分类ID
'name' M string 分类名
'upstream_id' M string 一级分类ID
"rank" M 0 排列顺序
}]
逻辑:
获取指定一级分类ID下的二级分类
返回二级分类信息列表
品类
/merchandise/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下的品类
/merchandise/template/pinlei/update 更新品类
Method: POST
请求:
id M string 品类ID
name M string 品类名称
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
逻辑:
判断品类ID是否存在
验证待修改的品类名是否重复
更新品类信息
/merchandise/template/pinlei/delete 删除品类
Method: POST
请求:
id M string 品类ID
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
逻辑:
判断品类ID是否存在
设置品类状态为删除
/merchandise/template/pinlei/get 获取品类信息
Method: GET
请求:
upstream_id 上游ID
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
data M list 返回的品类信息
[{
'id' M string 分类ID
'name' M string 分类名
'upstream_id' M string 二级分类ID
}]
逻辑:
获取指定二级分类ID下的品类
返回二品类信息列表
云商品库管理
/merchandise/template/spu/list 拉取云商品列表接口
Method
GET
请求
# 查询参数, 存在优先级:pinlei_ids > category2_ids > category1_ids
category1_ids O list 一级分类ID列表
category2_ids O list 二级分类ID列表
pinlei_ids O list 品类ID列表
search_text O string 搜索参数(按SPU别名、SPUID搜索)
# 分页参数,可参考[分页规范详解](https://doc.guanmai.cn/模块文档/分页/)
page_obj O string 起始页(不包含),默认第0页
reverse O bool 是否反向查询。1:是,0:不是。默认为否。
limit O int 返回条数,默认10。传0表示返回所有数据。
offset O int 查询起点偏移条数,默认0
peek O int 是否需要 pick,默认 false;peek 必须大于 limit。
count O bool 是否需要 count,1:是,0:不是。默认为否。(部分接口可能不实现本功能, 因为如果数据量极大,count 会很耗时)
响应
{
"code": 0, # 返回码,0表示成功,其他表示错误
"msg": "ok",
"data": [
{
"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":"进口香蕉"
},
...
],
"pagination": { M dict
"peek": 100, O int 前端传 peek 的话,后端就会返回这个字段
"more": true, M bool 是否有更多数据
"page_obj": "xx", M string
"count": 2000 O int 前端传 count 的话,后端就会返回这个字段
}
}
/merchandise/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
/merchandise/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信息
/merchandise/template/spu/detail spu模版详情
Method: GET
请求:
id M string spuID
响应:
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:无效
}
/merchandise/template/spu/delete spu模版删除
Method: POST
请求:
id M string spuID
响应:
code M int 0为成功,其它为失败
msg M string 错误提示信息
上传图片
/image/upload 上传图片到腾讯云
Method
POST
请求
image_file file M
响应
{
data: {
"img_url": url, str M
"img_path_id": filename str M
},
code: 0,
msg: "ok"
}