- 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) {
|
||||
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
|
||||
pageSize := 100
|
||||
pageNo := 1
|
||||
urlTemplate := "order/newManager/tabQuery/all?o2oOrderType=10000&pageNo=%d&pageSize=%d&orderBy=&desc=true&startTimeQuery=%s&endTimeQuery=%s&stationNo="
|
||||
for {
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user