- return error when no store find in PoiGet

This commit is contained in:
gazebo
2018-12-04 10:41:10 +08:00
parent d1d7678315
commit 57c6abbac0

View File

@@ -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