京东商城创建直辖市
This commit is contained in:
@@ -107,25 +107,28 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
||||
}
|
||||
//证明这个店可能隶属直辖市
|
||||
if model.ZXCityCodeMap[store.CityCode] != "" {
|
||||
result1, _ := api.JdShopAPI.GetProvince()
|
||||
for _, v := range result1 {
|
||||
if strings.Contains(model.ZXCityCodeMap[store.CityCode], v.AreaName) {
|
||||
result2, _ := api.JdShopAPI.GetCity(v.AreaID)
|
||||
for _, vv := range result2 {
|
||||
if strings.Contains(store.DistrictName, vv.AreaName) {
|
||||
result3, _ := api.JdShopAPI.GetCounty(vv.AreaID)
|
||||
for _, vvv := range result3 {
|
||||
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||
if result["regeocode"] != nil {
|
||||
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
|
||||
if street != "" {
|
||||
result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat))
|
||||
if result["regeocode"] != nil {
|
||||
street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string)
|
||||
if street != "" {
|
||||
result1, _ := api.JdShopAPI.GetProvince()
|
||||
for _, v := range result1 {
|
||||
if strings.Contains(model.ZXCityCodeMap[store.CityCode], v.AreaName) {
|
||||
result2, _ := api.JdShopAPI.GetCity(v.AreaID)
|
||||
for _, vv := range result2 {
|
||||
if strings.Contains(store.DistrictName, vv.AreaName) {
|
||||
result3, _ := api.JdShopAPI.GetCounty(vv.AreaID)
|
||||
for _, vvv := range result3 {
|
||||
if street == vvv.AreaName {
|
||||
createEntityStoreParam.AddCode = vvv.AreaID
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user