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