- CommonShopCities
This commit is contained in:
@@ -15,18 +15,7 @@ type CityInfo struct {
|
||||
func (a *API) CommonShopCities(parentID int) (cityList []*CityInfo, err error) {
|
||||
result, err := a.AccessAPI("common.shopcities", utils.Params2Map("pid", parentID))
|
||||
if err == nil {
|
||||
cityMapList := utils.Slice2MapSlice(result.Data.([]interface{}))
|
||||
// baseapi.SugarLogger.Debug(utils.Format4Output(cityMapList, false))
|
||||
cityList = make([]*CityInfo, len(cityMapList))
|
||||
for k, v := range cityMapList {
|
||||
cityList[k] = &CityInfo{
|
||||
ID: int(utils.Str2Int64(utils.Interface2String(v["city_id"]))),
|
||||
Name: utils.Interface2String(v["city_name"]),
|
||||
ParentID: int(utils.Str2Int64(utils.Interface2String(v["parent_id"]))),
|
||||
IsOpen: int(utils.Str2Int64(utils.Interface2String(v["is_open"]))),
|
||||
}
|
||||
}
|
||||
return cityList, nil
|
||||
err = utils.Map2StructByJson(result.Data, &cityList, true)
|
||||
}
|
||||
return nil, err
|
||||
return cityList, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user