From bfb0b139fa5460a24e5612397800b6dab88b7af3 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 11 Jan 2019 15:09:55 +0800 Subject: [PATCH] - jd.GetStoreOrderInfoList --- platformapi/jdapi/store_page.go | 11 +++++++++++ platformapi/jdapi/store_page_test.go | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/platformapi/jdapi/store_page.go b/platformapi/jdapi/store_page.go index b19cdf3a..041824f0 100644 --- a/platformapi/jdapi/store_page.go +++ b/platformapi/jdapi/store_page.go @@ -3,6 +3,7 @@ package jdapi import ( "fmt" "net/http" + "net/url" "git.rosy.net.cn/baseapi" "git.rosy.net.cn/baseapi/platformapi" @@ -90,3 +91,13 @@ func (a *API) GetStoreOrderInfo(orderId string) (storeOrderInfo map[string]inter } return nil, err } + +func (a *API) GetStoreOrderInfoList(fromTime, toTime string) (storeOrderList []map[string]interface{}, err error) { + retVal, err := a.AccessStorePage(fmt.Sprintf("order/newManager/tabQuery/all?o2oOrderType=10000&pageNo=1&pageSize=9999&orderBy=&desc=true&startTimeQuery=%s&endTimeQuery=%s&stationNo=", url.QueryEscape(fromTime), url.QueryEscape(toTime))) + // baseapi.SugarLogger.Debug(utils.Format4Output(retVal, false)) + if err == nil { + resultList := retVal["result"].(map[string]interface{})["newOrderinfoMains"].(map[string]interface{})["resultList"].([]interface{}) + return utils.Slice2MapSlice(resultList), nil + } + return nil, err +} diff --git a/platformapi/jdapi/store_page_test.go b/platformapi/jdapi/store_page_test.go index 0942fe67..e7fbd920 100644 --- a/platformapi/jdapi/store_page_test.go +++ b/platformapi/jdapi/store_page_test.go @@ -29,3 +29,11 @@ func TestGetStoreOrderInfo(t *testing.T) { } baseapi.SugarLogger.Debug(utils.Format4Output(orderInfo, false)) } + +func TestGetStoreOrderInfoList(t *testing.T) { + orderInfoList, err := jdapi.GetStoreOrderInfoList("2018-10-01 00:00:00", "2018-10-01 00:59:59") + if err != nil { + t.Fatal(err) + } + baseapi.SugarLogger.Debug(utils.Format4Output(orderInfoList, false)) +}