- 2019-07-26 疑似饿百将门店返回的坐标类型从float64改为string了

This commit is contained in:
gazebo
2019-07-26 10:10:11 +08:00
parent 63828ed903
commit 85d218fbec

View File

@@ -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 {