说明: 用一个字节二进制代表星期一到星期天
例如
1111111b 转换为十进制为127代表星期一到星期天都可以收货
0000011b 转换为十进制3代表星期一和星期二可以收货
数据库结构改动:
1 . 新增mysql表tbl_receive_weekday
use xnn_core_prouct_2
CREATE TABLE `tbl_receive_weekday` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`station_id` varchar(16) NOT NULL COMMENT '所属station',
`group_id` int(11) NOT NULL COMMENT '所属group',
`time_config_id` varchar(30) NOT NULL COMMENT '运营时间id',
`address_id` int(11) NOT NULL COMMENT '客户地址id',
`customer_weekdays` int(11) COMMENT '客户可选收货星期, 二进制最大值1111111b 十进制127,存储十进制',
`create_time` datetime NOT NULL COMMENT '创建时间',
`delete_time` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '删除时间,未删除为 1-1-1 00:00:00',
`modify_time` datetime NOT NULL COMMENT '最后修改时间',
`pstatus` tinyint(1) NOT NULL DEFAULT '0' COMMENT '物理状态,0:正常--默认,1:已删除',
`extra1` int(11) NOT NULL DEFAULT '0',
`extra2` int(11) NOT NULL DEFAULT '0',
`extra3` int(11) NOT NULL DEFAULT '0',
`extra4` varchar(128) NOT NULL DEFAULT '',
`extra5` varchar(128) NOT NULL DEFAULT '',
`extra6` varchar(128) NOT NULL DEFAULT '',
`extra7` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra8` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra9` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`extra10` decimal(15,4) NOT NULL DEFAULT '0.0000',
PRIMARY KEY (`id`),
KEY `idx_st_ids` (`station_id`, `time_config_id`)
) ENGINE=InnoDB;
2 . 修改mongo表service_time
添加weekdays(运营时间的收货星期, 最大为1111111b->127), 其他保持不变.
{
"_id" : "ST319",
"receive_time_limit" : {
"end" : "23:30",
"start" : "00:00",
"e_span_time" : 6,
"receiveTimeSpan" : "60",
"receiveEndSpan" : 0,
"s_span_time" : 1,
"weekdays": 127, # 新增: 运营时间可选的收货星期最大值01111111b 十进制127
},
"final_distribute_time" : "23:00",
"final_distribute_time_span" : 0,
"name" : "早餐档",
"order_time_limit" : {
"end" : "23:00",
"start" : "06:00",
"e_span_time" : 0
},
"service_time_creator" : "T3476",
"desc" : "测试运营时间",
"type" : 2,
"task_begin_time" : "00:00"
}
Staion接口改动
1 . [修改老接口]运营时间详情获取接口
Request URL:
https://station.guanmai.cn/station/service_time
Request Method:
GET
请求(不变):
id M string 运营时间id
less O string 为1时,只返回名字(name)和描述(desc)等必要信息(只在查看运营时间列表的时候有控制作用)
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
id: ST1305
less: 1
response:
{
"msg": "ok",
"code": 0,
"data": {
"name": "预售运营时间",
"type": 2,
"desc": "",
"order_time_limit": {
"e_span_time": 0,
"end": "19:30",
"start": "00:00"
},
"final_distribute_time": "19:30",
"receive_time_limit": {
"receiveEndSpan": 1,
"s_span_time": 0,
"end": "09:00",
"receiveTimeSpan": "15",
"e_span_time": 14,
"start": "09:00",
"weekdays": 127, // 新增: 该运营时间可选收货星期列表
},
"task_begin_time": "09:00",
"final_distribute_time_span": 0,
"_id": "ST1305",
"service_time_creator": "T7936"
}
}
2 .[新增]获取某个运营时间下客户收货日期接口
Request URL:
https://station.guanmai.cn/station/service_time/customer/weekday/list
Request Method:
GET
请求:
time_config_id M string 运营时间id
search_text O string 搜索文本,如果以S开头,以商户id进行搜索,否则按照地址
page_obj O string 起始页(不包含),默认第0页
reverse O bool 是否反向查询。1:是,0:不是。默认为否。
limit O int 返回条数,默认10。传0表示返回所有数据。
offset O int 查询起点偏移条数,默认 0 [注1]
peek O int 是否需要 peek,默认不需要 peek。peek 必须大于 limit。
count O bool 是否需要 count,默认不需要 count。(部分接口可能不实现本功能, 因为如果数据量极大,count 会很耗时)
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
无
response:
code: 0
data: [
{
"address_id": 1234,
"restaurant_name": "黄焖鸡米饭1"
"weekdays": 127, // address_id为1234的客户星期一到星期天均可收货
},
{
"address_id": 4567,
"restaurant_name": "重庆火锅"
"weekdays": 7, // address_id为4567的客户星期一到星期三可收货
}
]
pagination: {
"more": false,
"page_obj": "{\"next\": {}, \"previous\": {\"_id\": \"PL4690801\"}}"
},
msg: "ok"
3 . [新增]更新某个运营时间下客户收货日期的接口
Request URL:
https://station.guanmai.cn/station/service_time/customer/weekday
Request Method:
POST
请求:
time_config_id M string 运营时间配置id
address_id M int 客户地址id
customer_weekdays M dict 运营时间下的客户可选收货星期
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
{
time_config_id: ST12345,
address_id: 123,
customer_weekdays: 7,
}
response:
code: 0
data: null
msg: "ok"
4 . [修改老接口]运营时间修改接口
Request URL:
https://station.guanmai.cn/station/service_time
Request Method:
POST
请求:
id M string 站点
name O string 运营时间名称
desc O string 描述
type O int 类型
final_distribute_time O string 最晚出库时间
final_distribute_time_span O string 最晚出库时间间隔天数
order_time_limit O dict 下单时间限制
receive_time_limit O dict 收货时间限制
task_begin_time O string 任务开始时间(默认设置为下单开始时间)
service_time_creator: T8521 O string 运营时间创建站点
_id: ST2448 O string 运营时间id
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
id: ST2448
name: sss-test
desc: 专门测试的
type: 2
final_distribute_time: 06:30
final_distribute_time_span: 0
order_time_limit: {"start":"06:30","e_span_time":0,"end":"23:00"}
receive_time_limit:
{
"start":"06:00",
"e_span_time":4,
"end":"12:00",
"receiveEndSpan":0,
"s_span_time":1,
"receiveTimeSpan":"15",
"weekdays": 127, # 新增, 运营时间下的可选收货星期
}
task_begin_time: 06:00
service_time_creator: T8521
_id: ST2448
reponse:
code: 0
data: "保存成功"
msg: "ok"
5 . [修改老接口]运营时间创建接口
Request URL:
https://station.guanmai.cn/station/service_time
Request Method:
POST
请求:
name M 运营时间名称
desc M 描述
type M 运营时间类型
final_distribute_time M 最晚出库时间
final_distribute_time_span M 最晚出库时间间隔天数
order_time_limit M 下单时间限制
receive_time_limit M 收货时间限制
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
name: sssss-test
desc: 专门测试二
type: 2
final_distribute_time: 07:00
final_distribute_time_span: 0
order_time_limit: {"e_span_time":0,"start":"06:00","end":"23:00"}
receive_time_limit:
{
"e_span_time":4,
"end":"12:00",
"s_span_time":1,
"start":"06:00",
"receiveTimeSpan":"15",
"receiveEndSpan":0,
"weekdays": 127, # 新增, 运营时间下的可选收货星期
}
reponse:
code: 0
data: "保存成功"
msg: "ok"
6 . [修改老接口]运营时间删除接口
Request URL:
https://station.guanmai.cn/station/service_time/delete
Request Method:
POST
请求:
id M 运营时间id
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
无
7 . [修改老接口]下单界面选择店铺之后获取客户运营时间
接口描述:
获取运营时间返回的数据中,添加店铺可下单weekdays, 主要是给前端判断是否把保存按钮禁用。
Request URL:
https://station.guanmai.cn/station/order/service_time?address_id=150858
Request Method:
GET
请求:
address_id M string 店铺id
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
address_id: 150858
response:
{
"data": {
"service_time": [
{
"task_begin_time": "04:30",
"_id": "ST2253",
"service_time_creator": "T8521",
"desc": "",
"final_distribute_time": "00:00",
"name": "lsk测试预售",
"receive_time": {
"defaultStart": "18:45",
"defaultSpanStartFlag": 0,
"defaultSpanEndFlag": 1,
"defaultEnd": "04:00"
},
"order_time_limit": {
"start": "00:00",
"e_span_time": 1,
"end": "00:00"
},
"receive_time_limit": {
"start": "04:30",
"e_span_time": 14,
"end": "04:00",
"receiveEndSpan": 1,
"s_span_time": 0,
"receiveTimeSpan": "15",
"weekdays": 127, # 新增: 运营时间可选收货自然星期
"customer_weekdays": 7 # 新增:该运营时间下客户对应的可选收货星期
}
"final_distribute_time_span": 1,
"type": 2
}
],
"time": "15:50",
"freight": {
"min_total_price": 0.0,
"section": [
{
"min": 0.0,
"max": 0.0,
"freight": 0.0
}
],
"_id": "Y001296"
}
},
"msg": "ok",
"code": 0
}
8 . [修改老接口]下单接口
接口描述:
修改下单接口,客户在该运营时间下可选收货星期和当前日期+收货日期限制计算出来收货星期的交集为空,不可下单
Request URL:
https://station.guanmai.cn/station/order/create
Request Method:
POST
请求(不变):
uid M string 用户id,
address_id M string 客户地址id,
details M list 订单商品明细,
time_config_id M string 运营时间id,
receive_begin_time M string 收货开始时间,
receive_end_time M string 收货结束时间,
force M int 是否强制合单,
remark O string 订单备注,
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
无
9 . [修改老接口] 批量导入订单增加限制
接口描述:
对于每一个address_id对应的客户,客户在该运营时间下可选收货星期和当前日期+收货日期限制计算出来收货星期的交集为空,不可下单
Request URL:
https://station.guanmai.cn/station/order/batch/upload
Request Method:
POST
请求(不变):
time_config_id M 运营时间配置id
file: (binary) M 需要批量导入的订单文件
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
无
10 . [修改老接口]订单详情获取接口
Request URL:
https://station.guanmai.cn/station/order/edit?id=PL4752329
Request Method:
GET
请求(不变):
id M string 订单id
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
id: PL4752329
response:
{
"data": {
"client": 2,
"close_time": null,
"is_purchase_task_new_synced": true,
"is_aggregation": 0,
"real_pay": 4200,
"pay_status": 10,
"district_name": "深圳市",
"real_price": 1200,
"salemenu_ids": [
"S6973"
],
"time_config_info": {
"desc": "",
"_id": "ST768",
"service_time_creator": "T8521",
"name": "自售1",
"order_time_limit": {
"start": "06:00",
"e_span_time": 0,
"end": "23:30"
},
"task_begin_time": "06:00",
"final_distribute_time": "06:00",
"receive_time_limit": {
"e_span_time": 1,
"start": "06:00",
"receiveTimeSpan": "15",
"s_span_time": 0,
"end": "06:00",
"weekdays": 127, # 新增:该运营时间下的收货星期
"customer_weekdays": 3 # 新增:该运营时间下客户可选收货星期
},
"final_distribute_time_span": 1,
"type": 1
},
"out_order_id": "",
"source_order_ids": [],
"freeze": 0,
"_id": "PL4752329",
"batch_remark": "",
"time_config_id": "ST768",
"modify_time": "2019-02-19T17:13:44.558",
"coupon_max_discount_percent": 0,
"coupon_amount": 0,
"_lock": "no",
"customer": {
"address": "宝安中心",
"receive_end_time": "2019-02-19 20:15",
"supply_station_id": "T8521",
"receive_begin_time": "2019-02-19 20:00",
"receiver_phone": "15111111111",
"uid": "59876",
"address_sign_id": "30400100000",
"address_id": "53681",
"extender": {
"resname": "zhoumin1",
"order_pay_method": 1
},
"receiver_name": "周"
},
"district_code": "440300",
"refund_amount": 0,
"sort_id": "无线路-5",
"serials": [
"4c5548b54630489c8d24cc08aa647ad2",
"eb0bf6f4524a4170932f8f065397862d",
"108ce890e93ac9fe37d9445f6ca63a89",
"c09c164dd1354400a3dd11c09bbc4c67"
],
"coupon_min_total_price": 0,
"last_op_time": "2019-02-19T17:14:22",
"details": [
{
"total_item_price": 4800.0,
"supplier_name": "蔬菜供应",
"is_print": false,
"sort_way": 1,
"std_unit_quantity": 4.0,
"weighted": 1,
"std_sale_price": 1200.0,
"spu_id": "C1232348",
"is_price_timing": false,
"id": "D3627935",
"tax": "0.00",
"real_refund_quantity": 0,
"category_title_2": "叶菜",
"search_text": [
"HUACAI",
"HC",
"花菜",
"",
"HUACAI",
"HC",
"花菜"
],
"std_real_quantity": 1.0,
"request_refund_quantity": 0,
"attrition_rate": 0.0,
"last_purchase_price": {
"earlier": [
{
"purchase_supplier_id": "T12478",
"purchase_supplier_name": "综合供应商",
"price": 300.0
},
{
"purchase_supplier_id": "T8524",
"purchase_supplier_name": "水果33供应商",
"price": 300.0
}
],
"newest": {
"purchase_supplier_id": "T8523",
"purchase_supplier_name": "蔬菜供应商",
"price": 0
}
},
"exc_quantity": 0,
"outer_id": "",
"out_of_stock": false,
"name": "花菜",
"sale_price": "12.00",
"sale_num_least": 4.0,
"accept_quantity": 1.0,
"salemenu_id": "S6973",
"origins": [],
"purchase_quantity": 4.0,
"version": 5,
"sync_origin": "D3627935",
"sale_money": 1200.0,
"std_unit_name": "斤",
"stock_avg_price": 234305.75637104723,
"weighting_quantity": 1.0,
"real_item_price": 1200.0,
"total_item_pay": 1200.0,
"sale_unit_name": "斤",
"is_weigh": 1,
"category_title_1": "蔬菜",
"last_in_stock_price": {
"earlier": [
{
"purchase_supplier_id": "T12478",
"purchase_supplier_name": "综合供应商",
"price": 300
}
],
"newest": {
"purchase_supplier_id": "T8523",
"purchase_supplier_name": "蔬菜供应商",
"price": 200
}
},
"real_quantity": 1.0,
"tax_rate": 0,
"last_quote_price": {
"earlier": [
{
"purchase_supplier_id": "T12478",
"purchase_supplier_name": "综合供应商",
"price": 300.0
}
],
"newest": {
"purchase_supplier_id": "T8523",
"purchase_supplier_name": "蔬菜供应商",
"price": 300.0
}
},
"real_is_weight": true,
"quantity": 4.0,
"sale_ratio": 1.0
}
],
"date_time": "2019-02-19T17:13:44.558",
"status": 5,
"coupon_id": 0,
"remark": null,
"total_price": 4800.0,
"exception_reason": {
"1": "未按用户时间到达",
"5": "漏单",
"6": "送错货品",
"7": "下错单",
"8": "需要备注",
"10": "斤两不对(用户发现)",
"12": "质量问题",
"176": "无法送达",
"17": "规格问题",
"22": "司机弄丢/弄坏",
"153": "采购问题",
"25": "市场缺货(未出库)",
"27": "系统问题",
"61": "其它"
},
"paid_amount": 4200,
"station_id": "T8521",
"total_pay": 1200,
"settle_way": 2,
"last_op_user": "zhoumin",
"expire_time": "2019-02-19T17:18:44.558",
"freight": 0.0,
"create_time": "2019-02-19T17:13:44.558"
},
"msg": "ok",
"code": 0
}
11 . 订单详情编辑接口
Request URL:
https://station.guanmai.cn/station/order/edit
Request Method:
POST
request(不变):
order_id M string 订单id
details M list 订单商品详情列表
order_data M dict 订单备注和收货时间信息
response:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
12 . [新增]客户某个运营时间下客户收货星期列表导出
接口描述:
根据搜索条件,导出符合该条件下下的客户收货星期.
Request URL:
https://station.guanmai.cn/station/service_time/customer/weekday/export
Request Method:
GET
请求:
time_config_id M string 运营时间id
search_text O string 搜索文本,如果以S或者s开头,以商户id进行搜索,否则按照地址
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M string 返回json数据
例子:
request:
time_config_id: ST2123
search_text: 海底捞
response:
{
"msg": "ok",
"code": 0,
"data": {
"async": 0, # 0:同步,1:异步
"task_url": None, # 异步返回url,同步则为None
customer_weekdays_info:[
[
# 第一个数组是Excel的表头信息, 后面的数组都是值
"商户ID",
"商户名",
"商户可选收货日"
],
[
77838,
"海底捞(南山店)",
127
],
[
77839,
"海底捞南头店",
127
],
]
}
}
Bshop接口改动
1 . [修改老接口] 获取报价单信息接口
接口描述:
主要用来获取报价单和报价单绑定的运营时间,增加返回运营时间内可选收货星期weekdays和客户指定的收货星期customer_weekdays
Request URL:
https://bshop.guanmai.cn/util/salemenu
Request Method:
GET
请求(不变):
无
响应:
code M int 返回码,0表示成功,其他表示错误
data M string 返回json数据
例子:
request:
无
response:
{
"data": [
{
"order_end_time": "2019-02-15 20:00:00",
"name": "自售单不许删",
"supplier_name": "自售单不许删",
"_id": "S12731",
"time_config_id": "ST2123",
"order_begin_time": "2019-02-15 00:00:00",
"station_id": "T7936",
"time_config_type": 2,
"weekdays": 127, # 新增:运营时间下设置的可选收货星期
"customer_weekdays": 7 # 新增: 返回address_id对应的可收货星期
}
],
"code": 0
}
2 . [修改老接口] 更新购物车
接口描述:
增加逻辑,如果根据当前日期计算出来的星期集合和当前报价单的运营时间配置里address_id对应的可选收货星期交集为空,那么不给加到购物车
Request URL:
https://bshop.guanmai.cn/cart/update
Request Method:
POST
请求(不变):
skus: [ M list sku列表
{"D3674547":2} M dict sku_id和数量的键值对
]
响应:
code M int 返回码,0表示成功,其他表示错误
data M string 返回json数据
msg M string 错误信息
例子:
request:
skus: [
{
"D3674547":3
}
]
response:
{
"code": 0,
"msg": "ok",
"data": {
"info": {
"sum_money": 21156.0,
"is_price_timing": false,
"count": 2
},
"list": {
"D3884723": 3.0
},
"invalid_skus": [
{
'code': 1,
'msg': _('商品当日不在可选收货星期内,无法加到购物车'),
'sku_id': sku_id,
'name': product['name']
}
]
}
}
3 . [修改老接口]订单确认
Request URL:
https://bshop.guanmai.cn/order/confirm
Request Method:
GET
请求(不变):
无
响应:
code M int 返回码,0表示成功,其他表示错误
data M string 返回json数据
msg M string 错误信息
例子:
request:
无
response:
{
"data": {
"is_price_timing": false,
"all_price": 23776,
"settle_time": "最迟2月25日",
"orders": [
{
"discounted_price": 0,
"station_id": "T8521",
"allow_remark": false,
"order_pay_method": null,
"salemenu_ids": [
"S6973"
],
"order_time_limit": {
"start": "06:00",
"e_span_time": 0,
"end": "23:30"
},
"receive_time": {
"receive_time_limit": {
"e_span_time": 1,
"time_config_id": "ST768",
"weekdays": 127, # 新增:该运营时间下可选收货星期返回
"customer_weekdays": 3, # 新增: 该运营时间下客户可选收货星期
"receiveEndSpan": null,
"r_start": "06:00",
"receiveTimeSpan": "15",
"s_span_time": 0,
"r_end": "06:00"
},
"msg": "02-19 20:00~02-20 00:15",
"order_flag": true,
"receive_time": {
"defaultSpanEndFlag": 1,
"defaultEnd": "00:15",
"defaultSpanStartFlag": 0,
"defaultStart": "20:00"
}
},
"order_id": null,
"is_price_timing": false,
"freight": 500,
"total_price": 23276,
"date_time": null,
"remark": null,
"sku_ids": [
"D3674547",
"D3884723",
"D2734171"
]
}
],
"address": {
"user_id": 59876,
"id": 159471,
"sales_employee_id": null,
"map_address": null,
"service_station_id": "",
"begintime": null,
"endtime": null,
"telephone": "13212312311",
"keycustomer": 0,
"lat": 0.0,
"remarks": null,
"name": "123",
"resname": "123",
"district_code": "440100",
"employee_id": null,
"settle_way": 2,
"freight": 0,
"area_id": 40200600000,
"create_time": "2018-12-21T15:45:17",
"addr_detail": "123",
"last_use_time": null,
"finance_status": 0,
"lng": 0.0
},
"finance_status": 0,
"all_discounted_price": 0,
"all_freight": 500
},
"code": 0,
"msg": "ok"
}
权限
一级权限运营时间设置下新增二级权限,编辑客户可选收货日
name: "编辑客户可选收获日"
name_en: "Edit Customer Receivetime Weekdays"
codename: "edit_customer_receivetime_weekdays"
content_type_id: 52
level2_id: 10