添加mtwmapi.RetailListAll

This commit is contained in:
gazebo
2019-10-23 17:35:33 +08:00
parent b1cef2f0f2
commit 1de70092df
2 changed files with 42 additions and 14 deletions

View File

@@ -193,6 +193,21 @@ func (a *API) RetailList(poiCode string, offset, limit int) (foodList []*AppFood
return foodList, err
}
func (a *API) RetailListAll(poiCode string) (foodList []*AppFood, err error) {
offset := 0
for {
batchList, err2 := a.RetailList(poiCode, offset, GeneralMaxLimit)
if err = err2; err == nil {
foodList = append(foodList, batchList...)
}
if len(batchList) < GeneralMaxLimit {
break
}
offset += GeneralMaxLimit
}
return foodList, err
}
func handleRetailBatchResult(result interface{}) (failedFoodList []*AppFoodResult, err error) {
if msg, ok := result.(string); ok && msg != "" {
err = utils.UnmarshalUseNumber([]byte(msg), &failedFoodList)