From 146314729260aa57c9271830d5fb02c21023c239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 30 Jun 2020 09:56:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=9B=B4=E8=BE=96=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jdshop/store.go | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/business/partner/purchase/jdshop/store.go b/business/partner/purchase/jdshop/store.go index ea2bd3bda..d797ec2cb 100644 --- a/business/partner/purchase/jdshop/store.go +++ b/business/partner/purchase/jdshop/store.go @@ -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 } } }