diff --git a/platformapi/ebaiapi/order.go b/platformapi/ebaiapi/order.go index 78c98d99..bcff47e4 100644 --- a/platformapi/ebaiapi/order.go +++ b/platformapi/ebaiapi/order.go @@ -31,11 +31,11 @@ const ( ) const ( - WaybillStatusNew = "2" // 生成运单 - WaybillStatusRequestDelivery = "3" // 请求配送 - WaybillStatusWait4Courier = "4" // 等待分配骑士 - WaybillStatusCourierAccepted = "7" // 骑士接单 - WaybillStatusCourierPickedup = "8" // 骑士取餐 + WaybillStatusNew = "2" // 生成运单 + WaybillStatusRequestDelivery = "3" // 请求配送 + WaybillStatusWait4Courier = "4" // 等待分配骑士 + WaybillStatusCourierAccepted = "7" // 骑士接单 + WaybillStatusCourierPickedup = "8" // 骑士取餐 // 饿百在发送运单取消事件后,如果订单没有及时(具体时间未知)转出自送,则订单会被取消,且不会发送订单取消事件 // https://open-be.ele.me/dev/answer/reedit?list_id=23667&question=my WaybillStatusDeliveryCancled = "15" // 配送取消 @@ -398,6 +398,16 @@ func (a *API) OrderGet2(orderID string) (order *OrderDetailInfo, err error) { return order, err } +func (a *API) OrderStatusGet(orderID string) (status int, err error) { + result, err := a.AccessAPI("order.status.get", map[string]interface{}{ + "order_id": orderID, + }) + if err == nil { + status = int(utils.ForceInterface2Int64(result.Data.(map[string]interface{})["status"])) + } + return status, err +} + // 设置订单快递单号 func (a *API) OrderExpressCreate(shopID string, expressList []*ExpressInfo) (status int, err error) { result, err := a.AccessAPI("order.express.create", map[string]interface{}{ diff --git a/platformapi/ebaiapi/order_test.go b/platformapi/ebaiapi/order_test.go index 4a9582b8..7fff85b5 100644 --- a/platformapi/ebaiapi/order_test.go +++ b/platformapi/ebaiapi/order_test.go @@ -16,7 +16,7 @@ func TestOrderGet(t *testing.T) { } func TestOrderGet2(t *testing.T) { - result, err := api.OrderGet2("1574550169196474502") + result, err := api.OrderGet2("1576493808229489038") if err != nil { t.Fatal(err) } else { @@ -24,6 +24,14 @@ func TestOrderGet2(t *testing.T) { } } +func TestOrderStatusGet(t *testing.T) { + result, err := api.OrderStatusGet("1576493808229489038") + if err != nil { + t.Fatal(err) + } else { + t.Log(utils.Format4Output(result, false)) + } +} func TestOrderList(t *testing.T) { result, err := api.OrderList("", 0, 0, 0, 0, 0) if err != nil {