改动涉及的db
sale_category
{
"_id" : "F098",
"upstream_id" : "E006",
"queue" : 1,
"station_id" : "T133",
"salemenu_id" : "S0139",
"title" : "最新饮料",
"level" : 2,
"sku_ids" : [
"D165319",
"D165318",
"D165317",
"D165316",
"D188721",
"D226240",
"D226239"
]
}
迁往mysql
CREATE TABLE `marketing_promotion`(
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(64) NOT NULL ,
`show_method` int(5) UNSIGNED NOT NULL COMMENT '1代表首页分类,2代表无,3代表广告滚动',
`label_1_name` varchar(64) DEFAULT NULL,
`sort` int(6) UNSIGNED DEFAULT NULL ,
`pic_url` VARCHAR(512) DEFAULT NULL ,
`station_id` VARCHAR(32) NOT NULL ,
`active` int(5) DEFAULT 1 COMMENT '1代表激活,0代表未激活',
`status` INT(5) DEFAULT 1 COMMENT '1代表存在,0代表删除',
`modify_time` DATETIME NOT NULL ,
`create_time` DATETIME NOT NULL ,
`operator` VARCHAR(64) not NULL ,
`extra1` int(11) DEFAULT NULL COMMENT '备份字段',
`extra2` int(11) DEFAULT NULL COMMENT '备份字段',
`extra3` varchar(32) DEFAULT NULL COMMENT '备份字段',
`extra4` varchar(32) DEFAULT NULL COMMENT '备份字段',
`extra5` datetime DEFAULT NULL COMMENT '备份字段',
`extra6` datetime DEFAULT NULL COMMENT '备份字段',
PRIMARY KEY (`id`),
key idx_station_id(`station_id`)
);
CREATE TABLE `promotion_label_2`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`promotion_id` INT UNSIGNED NOT NULL ,
`name` VARCHAR(64) NOT NULL ,
`sort` int(6) UNSIGNED DEFAULT NULL ,
`status` INT(5) DEFAULT 1 COMMENT '1代表存在,0代表删除',
`create_time` DATETIME NOT NULL ,
`update_time` DATETIME NOT NULL ,
`extra1` int(11) DEFAULT NULL COMMENT '备份字段',
`extra2` int(11) DEFAULT NULL COMMENT '备份字段',
`extra3` varchar(32) DEFAULT NULL COMMENT '备份字段',
`extra4` varchar(32) DEFAULT NULL COMMENT '备份字段',
`extra5` datetime DEFAULT NULL COMMENT '备份字段',
`extra6` datetime DEFAULT NULL COMMENT '备份字段',
PRIMARY KEY (`id`),
key idx_promotion_id (`promotion_id`, `sku_id`) COMMENT 'cover index'
);
CREATE TABLE `promotion_sku`(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`promotion_id` INT UNSIGNED NOT NULL ,
`sku_id` VARCHAR(32) NOT NULL ,
`salemenu_id` VARCHAR(32) NOT NULL ,
`status` INT(5) DEFAULT 1 COMMENT '1代表存在,0代表删除',
`label_2_id` INT UNSIGNED DEFAULT NULL ,
`label_1_name` varchar(64) DEFAULT NULL,
`label_2_name` varchar(64) DEFAULT NULL,
`create_time` DATETIME NOT NULL ,
`update_time` DATETIME NOT NULL ,
`extra1` int(11) DEFAULT NULL COMMENT '备份字段',
`extra2` int(11) DEFAULT NULL COMMENT '备份字段',
`extra3` varchar(32) DEFAULT NULL COMMENT '备份字段',
`extra4` varchar(32) DEFAULT NULL COMMENT '备份字段',
`extra5` datetime DEFAULT NULL COMMENT '备份字段',
`extra6` datetime DEFAULT NULL COMMENT '备份字段',
PRIMARY KEY (`id`),
key idx_sku_id_salemenu_id (`sku_id`, `salemenu_id`),
key idx_promotion_id (`promotion_id`)
);
修改的接口(bshop)
/product/promotion/get 获取营销及分类列表
Method: GET
request:
无
response:
{
"code": 0,
"msg": "ok"
增加一种数据返回类型
"data":
{
"pic_url": str,
"promotion_name": str,
"rank": int 排序,
"promotion_id": int
"label_1": {'name': str},
"label_2": [{'id': int, 'name': str}, ...],
label_1 和label_2都是可能存在的,前端根据存在与否判断展示级别。
}
]
}
新增接口(bshop)
/product/promotion_sku/get 获取对应的sku
Method: GET
request:
promotion_id int M
label_2_id int O
response:
msg: ok
code: 0
data:[
{
'cart_amount': int,
'id': str spu_id,
'img_url': str,
'is_fav': false,
'name': str,
'rank': 0,
'salemenu_id': str,
'std_sale_price': int,
'std_unit_name': str,
'skus': [
'cart_amount': int,
'category_id_1': str,
'category_id_2': str,
'desc': str,
'id': str sku_id,
'img_url': str,
'is_price_timeing': bool,
'is_valid': bool,
'name': str,
'rule_price': float,
'sale_num_least': int,
'sale_price': float,
'sale_ratio': float,
'sale_unit_name': str,
'salemenu_id': str,
'spu_id': str,
'state': int,
'station_id': str,
'std_sale_price': float,
'std_unit_name': str,
'stocks': int
]
}
]
新增接口(station)
/station/promotion/list 营销活动搜索
Method GET
request
active int (1有效,0无效)
show_method int M (1代表首页分类,2无,3代表广告滚动)
search_text str O
offset int O default 0
limit int O default 10
response
code: 0
msg: ok
data: [
{
'name': str,
'show_method': int,
'active': int 1代表存在,0代表删除,
'sku_nums': int,
'operator': str,
'create_time': datetime,
'id': int, 营销活动id
},
...
]
/station/promotion/detail 营销活动详情
Method Post
request
id int M
response:
code: 0
msg: ok
data: {
'name': M str,
'active': M int,
'show_method': M int,
'sort': M int,
'label_1_name': O str,
'pic_url': M str,
'enable_label_2': M INT,
'label_2': [
O {'id': int, 'name': str, 'sort': INT},
...
],
'skus': [
{
'id': str,
'label_1_name': O str,
'label_2_name': O str,
'label_2_id': O int
},
...
]
}
/station/promotion/update 编辑营销活动
Method POST
request:
id int M
name str O
active int O
show_method int O
enable_label_2 int O
sort int O
pic_url str O
label_1_name O str
label_2 : [
{
'name': str,
'sort': o INT
},
....
有id为编辑,没有id为新增,少id为删除
],
skus: [
{
'id': str,
'name': str,
'label_1_name': O str,
'label_2_name': O str
},
...
]
/station/promotion/create 创建营销活动
Method Post
request:
name str M
show_method int M
sort int O
active int M
pic_url str O
label_1_name O str
enable_label_2 M INT 1代表激活,0不激活
label_2 : O [
{
'name': str,
'sort': O int
}
....
],
skus: O [
{
'id': str,
'label_1_name': O str,
'label_2_name': O str
},
...
]
/station/promotion/delete 删除营销活动
Method Post
request:
id int M
response:
code: 0
msg: ok
data: null
/station/promotion/sku/get 获取这个站点下的sku
Method GET
request:
search_text str O
response
code: 0
msg: ok
data: [
{
'id': 'xxx'
'name': 'xxxx',
'children': [
{
'id': 'xxxx'.
'name': 'xxxx',
'children': [
{
'id': 'xxxx',
'name': 'xxxx'
}
]
}
]
}
]
## 搜索sku传search_text
返回: [{'sku_id': xxx, 'name': 'xxxx'}, ....]