添加mtwmapi.RetailListAll
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user