- jdapi.GetAllCities
This commit is contained in:
@@ -35,6 +35,23 @@ type CreateShopResult struct {
|
|||||||
StationNo string `json:"stationNo"`
|
StationNo string `json:"stationNo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CityInfo struct {
|
||||||
|
AreaCode int `json:"areaCode"`
|
||||||
|
AreaLevel int `json:"areaLevel"`
|
||||||
|
AreaName string `json:"areaName"`
|
||||||
|
ParentAreaID int `json:"parentAreaId"`
|
||||||
|
TencentAddressCode int `json:"tencentAddressCode"`
|
||||||
|
Yn int `json:"yn"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *API) GetAllCities() (cities []*CityInfo, err error) {
|
||||||
|
result, err := a.AccessAPINoPage("address/allcities", nil, nil, nil, genNoPageResultParser("code", "msg", "result", "0"))
|
||||||
|
if err == nil {
|
||||||
|
err = utils.Map2StructByJson(result, &cities, false)
|
||||||
|
}
|
||||||
|
return cities, err
|
||||||
|
}
|
||||||
|
|
||||||
// 获取门店编码列表接口
|
// 获取门店编码列表接口
|
||||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=138426aa19b54c48ae8464af1ca3b681
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=194&apiid=138426aa19b54c48ae8464af1ca3b681
|
||||||
func (a *API) GetStationsByVenderId() ([]string, error) {
|
func (a *API) GetStationsByVenderId() ([]string, error) {
|
||||||
|
|||||||
@@ -13,6 +13,14 @@ const (
|
|||||||
mustExistStoreJXID = "100285"
|
mustExistStoreJXID = "100285"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestGetAllCities(t *testing.T) {
|
||||||
|
result, err := api.GetAllCities()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
func TestGetStationsByVenderId(t *testing.T) {
|
func TestGetStationsByVenderId(t *testing.T) {
|
||||||
result, err := api.GetStationsByVenderId()
|
result, err := api.GetStationsByVenderId()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user