- up
This commit is contained in:
@@ -93,11 +93,23 @@ func (a *API) GetStoreOrderInfo(orderId string) (storeOrderInfo map[string]inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) GetStoreOrderInfoList(fromTime, toTime string) (storeOrderList []map[string]interface{}, err error) {
|
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)))
|
pageSize := 100
|
||||||
// baseapi.SugarLogger.Debug(utils.Format4Output(retVal, false))
|
pageNo := 1
|
||||||
if err == nil {
|
urlTemplate := "order/newManager/tabQuery/all?o2oOrderType=10000&pageNo=%d&pageSize=%d&orderBy=&desc=true&startTimeQuery=%s&endTimeQuery=%s&stationNo="
|
||||||
resultList := retVal["result"].(map[string]interface{})["newOrderinfoMains"].(map[string]interface{})["resultList"].([]interface{})
|
for {
|
||||||
return utils.Slice2MapSlice(resultList), nil
|
retVal, err := a.AccessStorePage(fmt.Sprintf(urlTemplate, pageNo, pageSize, url.QueryEscape(fromTime), url.QueryEscape(toTime)))
|
||||||
|
// baseapi.SugarLogger.Debug(utils.Format4Output(retVal, false))
|
||||||
|
if err == nil {
|
||||||
|
newOrderinfoMains := retVal["result"].(map[string]interface{})["newOrderinfoMains"].(map[string]interface{})
|
||||||
|
resultList := newOrderinfoMains["resultList"].([]interface{})
|
||||||
|
storeOrderList = append(storeOrderList, utils.Slice2MapSlice(resultList)...)
|
||||||
|
if len(storeOrderList) >= int(utils.MustInterface2Int64(newOrderinfoMains["totalCount"])) {
|
||||||
|
return storeOrderList, nil
|
||||||
|
}
|
||||||
|
pageNo++
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func TestGetRealMobileNumber4Order(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetStoreOrderInfo(t *testing.T) {
|
func TestGetStoreOrderInfo(t *testing.T) {
|
||||||
orderId := "820995196000122"
|
orderId := "826309564000021"
|
||||||
// desiredMobile := "18569035610"
|
// desiredMobile := "18569035610"
|
||||||
orderInfo, err := jdapi.GetStoreOrderInfo(orderId)
|
orderInfo, err := jdapi.GetStoreOrderInfo(orderId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -31,9 +31,11 @@ func TestGetStoreOrderInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetStoreOrderInfoList(t *testing.T) {
|
func TestGetStoreOrderInfoList(t *testing.T) {
|
||||||
orderInfoList, err := jdapi.GetStoreOrderInfoList("2018-10-01 00:00:00", "2018-10-01 00:59:59")
|
orderInfoList, err := jdapi.GetStoreOrderInfoList("2018-05-01 12:00:00", "2018-05-01 12:59:59")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
baseapi.SugarLogger.Debug(utils.Format4Output(orderInfoList, false))
|
if true {
|
||||||
|
baseapi.SugarLogger.Debug(utils.Format4Output(orderInfoList, false))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user