开放接口
提供获取access_token、单个详情订单查询、列表订单查询、修改订单这四个接口
各状态解释
状态 | 解释 |
---|---|
1 | 等待订单出库 |
5 | 订单正在分拣 |
10 | 订单正在配送 |
15 | 订单已签收 |
100 | 订单已支付 |
各价格详细解释
单词 | 意思 |
---|---|
real_item_price | 商品总价格 |
sale_price | 销售单价 |
real_price | 订单金额 |
total_pay | 总共需付价格,加上了运费 |
获取access_token
功能:使用本平台提供的secret和access_id,换取安全传输的校验身份access_token,过期时间是1个小时,每个接口都要传输access_token
HTTPS GET
url https://station.guanmai.cn/openapi/auth/access_token
请求参数:
access_id M(必填) str 站点id
secret M(必填) str 秘钥
返回数据:
{
"msg": "ok",
"data": {
"access_token": "swbtoen3ir2snmcabgyq5vaaa5ep42xs",
"expire_time" : "2017-07-01 12:23:32" # 这个时间过期
},
"code": 0
}
订单详情查询
接口名:https://station.guanmai.cn/openapi/order/get
Method:GET
请求:
order_id M(必填) str 订单号
access_token M str 校验token
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M dict 数据字段为订单表字段;
示例:
request:
https://station.guanmai.cn/openapi/order/get?access_token=dcvvu02xr9k1mqidfi2k4s3mxv33us6i&order_id=PL492416
response:
{
"data": {
"freight": 2000, # 运费,单位分
"status": 10, # 状态 -1: '订单已删除', 1: '等待出库', 5: '正在分拣', 10: '正在配送', 15: '已签收', 100: '已支付',
"real_price": 728, # 真实价格(根据真实重量算出的真实价格),单位分
"customer": {
"resname": "盐田区沙头角中学沙县小吃" # 商户信息
"address": "沙头角东和路55号", # 收货地址
"receiver_phone": "18033432789", # 收货人手机号
"receive_begin_time": "2017-06-22 06:00", # 收货开始时间
"receive_end_time": "2017-06-22 12:00", # 收货结束时间
"receiver_name": "邓华君" # 收货人姓名
},
"date_time": "2017-06-21T17:29:38.913", # 下单时间
"remark": null, # 备注
"details": [
{
"category_title_2": "叶菜类", # 二级分类名
"std_unit_name": "斤", # 基本单位
"sale_unit_name": "斤", # 销售单位
"real_item_price": 728, # 真实总价,单位分
"real_quantity": 1, # 称重后数量
"category_title_1": "蔬菜", # 一级分类名
"spu_remark": "", # 备注
"accept_quantity": 1, # 收货数量
"supplier_name": "小农女", # 供应商名称
"quantity": 1, # 下单数量
"purchase_quantity": 1, # 采购数量
"sale_price": "7.28", # 销售单价,单位元
"name": "白菜苔|斤", # 商品名
"sale_ratio": 1, # 销售规格
"spu_id": "C00865", # spuid,商品id
"id": "D805677", # sku ID,修改订单时候的参数,规格id
"is_weight": true, #是否需要称重
"has_weight": true, #是否已经称重
"salemenu_name":"哈", # 采购单名称
}
],
"sort_id": 2, # 分拣序号
"total_pay": 2728, # 应付金额(加上运费的),单位分
},
"msg": "ok",
"code": 0
}
修改订单
注意:只有订单状态是1(等待出库)和5(正在分拣)时才能够修改单价 access_token M str 校验token,需放在url里面,不能放在post的body里面
接口名:https://station.guanmai.cn/openapi/order/update?access_token=lkjlk1jlkjk4j1kj5
功能: 可以修改订单里面商品的单价,数量,备注,以及收货时间
Method:POST
请求:
order_id M str 订单号
receive_begin_time O str 收货开始时间,格式:年-月-日 时:分:秒 例如:2017-06-22 19:15:00
receive_end_time O str 收货截止时间,格式同上
status O int 订单状态,1:等待分拣 5:正在分拣 状态能从1>5,1>10,5>10
sku_id O str 商品id,修改单个商品时必传
amount O int 商品数量
price O int 商品单价,单位分
remark O str 商品备注
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M dict_str 数据字段为订单表字段;
示例:
Response:
{
"code": 0,
"data": null,
"msg": "ok"
}
条件查询返回订单列表
注意:查询时间长度限制在7天
接口名:https://station.guanmai.cn/openapi/orders
功能: 可以根据下单时间、收货时间、商户名筛选订单
Method:GET
请求:
access_token M str 校验token
query_type M int 搜索类型 [1: 按照下单时间搜索 2: 按照收货日期搜索]
start_date M string 开始日期,格式要求:年-月-日 例如:2017-06-01
end_date M string 截止日期,格式要求:年-月-日 例如:2017-06-01
sort_type O string 排序类型(date_desc日期倒序(默认);date_asc日期升序;price_desc价格倒序;price_asc价格升序)
status O int 订单状态
offset O int 分页offset,默认0
limit O int 分页limit,最大100条每页
响应:
code M int 返回码,0表示成功,其他表示错误
msg M string 错误信息
data M list 数据字段为订单表字段;
示例:
request: https://station.guanmai.cn/openapi/orders?access_token=dcvvu02xr9k1mqidfi2k4s3mxv33us6i&query_type=1&start_date=2017-06-20&end_date=2017-06-24
Response:
{
"data": {
"list": [
{
"origin_total_price": "146.31", # 下单原价,单位元
"date_time_str": "2017-06-14 12:09:25", # 下单时间
"receive_end_time": "2017-06-13 12:00", # 收货截止时间
"status": 10, # 订单状态
"sort_id": null, # 分拣号
"id": "PL492271", # 订单ID
"receive_begin_time": "2017-06-13 06:00", # 收货开始时间
"total_price": "146.31", # 下单执行总价,单位元
"resname": "湘有缘饭店" # 商户名称
"freight": "20.00" # 运费,单位元
}
],
"pagination": {
"limit": 20,
"offset": 0
}
},
"msg": "ok",
"code": 0
}