From 85d218fbec62e2343f638e8d6a2e3de9890645f1 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 26 Jul 2019 10:10:11 +0800 Subject: [PATCH] =?UTF-8?q?-=202019-07-26=20=E7=96=91=E4=BC=BC=E9=A5=BF?= =?UTF-8?q?=E7=99=BE=E5=B0=86=E9=97=A8=E5=BA=97=E8=BF=94=E5=9B=9E=E7=9A=84?= =?UTF-8?q?=E5=9D=90=E6=A0=87=E7=B1=BB=E5=9E=8B=E4=BB=8Efloat64=E6=94=B9?= =?UTF-8?q?=E4=B8=BAstring=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/ebai/store.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/ebai/store.go b/business/partner/purchase/ebai/store.go index 0a7a532a2..b4e9884c7 100644 --- a/business/partner/purchase/ebai/store.go +++ b/business/partner/purchase/ebai/store.go @@ -71,6 +71,14 @@ func (p *PurchaseHandler) CreateStore(db *dao.DaoDB, storeID int, userName strin return "", err } +// 2019-07-26 疑似饿百将门店返回的坐标类型从float64改为string了 +func getCoordintate(data interface{}) float64 { + if str, ok := data.(string); ok { + return utils.Str2Float64WithDefault(str, 0) + } + return utils.MustInterface2Float64(data) +} + func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string) (*dao.StoreDetail, error) { baiduShopID := utils.Str2Int64(vendorStoreID) result, err := api.EbaiAPI.ShopGet("", baiduShopID) @@ -96,8 +104,8 @@ func (p *PurchaseHandler) ReadStore(ctx *jxcontext.Context, vendorStoreID string retVal.Tel2 = tel2 } - lng := utils.MustInterface2Float64(result["longitude"]) - lat := utils.MustInterface2Float64(result["latitude"]) + lng := getCoordintate(result["longitude"]) + lat := getCoordintate(result["latitude"]) if utils.Interface2String(result["coord_type"]) == ebaiapi.CoordTypeBaidu { var err2 error if lng, lat, err2 = api.AutonaviAPI.CoordinateConvert(lng, lat, autonavi.CoordSysBaidu); err2 != nil {