- return error when no store find in PoiGet
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -45,6 +46,9 @@ func (a *API) PoiMGet(poiCodes []string) (pois []map[string]interface{}, err err
|
||||
func (a *API) PoiGet(poiCode string) (poi map[string]interface{}, err error) {
|
||||
result, err := a.PoiMGet([]string{poiCode})
|
||||
if err == nil {
|
||||
if len(result) == 0 {
|
||||
return nil, fmt.Errorf("找不到ID为%s的美团外卖门店", poiCode)
|
||||
}
|
||||
return result[0], nil
|
||||
}
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user