From c5d1eb78c5885db068d5f8e0e896906b5ed3afd6 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 2 Apr 2019 14:33:31 +0800 Subject: [PATCH] - Interface2FloatWithDefault to Interface2Float64WithDefault --- business/jxstore/cms/store.go | 4 ++-- business/jxutils/cache/redis/redis_test.go | 4 ++-- business/partner/delivery/dada/waybill.go | 4 ++-- business/partner/purchase/ebai/order.go | 4 ++-- business/partner/purchase/elm/order.go | 2 +- business/partner/purchase/elm/waybill.go | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index ebdaf4081..78d1aecac 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -405,8 +405,8 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa } var lng, lat float64 if payload["lng"] != nil || payload["lat"] != nil { - lng = utils.Interface2FloatWithDefault(payload["lng"], 0.0) - lat = utils.Interface2FloatWithDefault(payload["lat"], 0.0) + lng = utils.Interface2Float64WithDefault(payload["lng"], 0.0) + lat = utils.Interface2Float64WithDefault(payload["lat"], 0.0) valid["lng"] = jxutils.StandardCoordinate2Int(lng) valid["lat"] = jxutils.StandardCoordinate2Int(lat) } diff --git a/business/jxutils/cache/redis/redis_test.go b/business/jxutils/cache/redis/redis_test.go index c15fdd3ff..789ece200 100644 --- a/business/jxutils/cache/redis/redis_test.go +++ b/business/jxutils/cache/redis/redis_test.go @@ -4,7 +4,7 @@ import ( "testing" "git.rosy.net.cn/jx-callback/business/jxutils/cache" - "git.rosy.net.cn/jx-callback/globals/testinit0" + "git.rosy.net.cn/jx-callback/globals/testinit1" ) var ( @@ -12,7 +12,7 @@ var ( ) func init() { - testinit0.Init() + testinit1.Init() cacher = New("localhost", 6379, "") } diff --git a/business/partner/delivery/dada/waybill.go b/business/partner/delivery/dada/waybill.go index 39e523672..e48b0b50a 100644 --- a/business/partner/delivery/dada/waybill.go +++ b/business/partner/delivery/dada/waybill.go @@ -62,8 +62,8 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap order.Status = model.WaybillStatusNew case dadaapi.OrderStatusAccepted: if result, err := api.DadaAPI.QueryOrderInfo(msg.OrderID); err == nil { - order.ActualFee = jxutils.StandardPrice2Int(utils.Interface2FloatWithDefault(result["actualFee"], 0.0)) - order.DesiredFee = jxutils.StandardPrice2Int(utils.Interface2FloatWithDefault(result["deliveryFee"], 0.0)) + order.ActualFee = jxutils.StandardPrice2Int(utils.Interface2Float64WithDefault(result["actualFee"], 0.0)) + order.DesiredFee = jxutils.StandardPrice2Int(utils.Interface2Float64WithDefault(result["deliveryFee"], 0.0)) } order.Status = model.WaybillStatusAccepted case dadaapi.OrderStatusDelivering: diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index 3a421e66f..cc1d13453 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -112,8 +112,8 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo } deliveryGeo := userMap["coord"].(map[string]interface{}) - originalLng := utils.Interface2FloatWithDefault(deliveryGeo["longitude"], 0.0) // 饿百的订单在过一段时间后,经纬度信息会变成字符串"**" - originalLat := utils.Interface2FloatWithDefault(deliveryGeo["latitude"], 0.0) + originalLng := utils.Interface2Float64WithDefault(deliveryGeo["longitude"], 0.0) // 饿百的订单在过一段时间后,经纬度信息会变成字符串"**" + originalLat := utils.Interface2Float64WithDefault(deliveryGeo["latitude"], 0.0) lng, lat, err2 := api.AutonaviAPI.CoordinateConvert(originalLng, originalLat, autonavi.CoordSysBaidu) if err2 == nil { originalLng = lng diff --git a/business/partner/purchase/elm/order.go b/business/partner/purchase/elm/order.go index 3e606af37..437cc7e4d 100644 --- a/business/partner/purchase/elm/order.go +++ b/business/partner/purchase/elm/order.go @@ -184,7 +184,7 @@ func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo VendorSkuID: utils.Int64ToStr(utils.Interface2Int64WithDefault(product["vfoodId"], 0)), SkuName: product["name"].(string), SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"])), - Weight: int(math.Round(utils.Interface2FloatWithDefault(product["weight"], 0.0))), + Weight: int(math.Round(utils.Interface2Float64WithDefault(product["weight"], 0.0))), } if sku.VendorSkuID == "0" { sku.VendorSkuID = utils.Int64ToStr(utils.MustInterface2Int64(product["id"])) // 2018-09-28日,饿了么迁移到饿百后,这个字段发生了变化 diff --git a/business/partner/purchase/elm/waybill.go b/business/partner/purchase/elm/waybill.go index 7d4dd4213..3396bad59 100644 --- a/business/partner/purchase/elm/waybill.go +++ b/business/partner/purchase/elm/waybill.go @@ -24,8 +24,8 @@ func (c *PurchaseHandler) onWaybillStatusMsg(msg *elmapi.CallbackWaybillStatusMs order.Status = model.WaybillStatusNew } else if msg.MsgType == elmapi.MsgTypeWaybillPickingUp { if result, err := api.ElmAPI.GetOrder(msg.OrderID); err == nil { - order.DesiredFee = jxutils.StandardPrice2Int(utils.Interface2FloatWithDefault(result["deliverFee"], 0.0) + - utils.Interface2FloatWithDefault(result["vipDeliveryFeeDiscount"], 0.0)) + order.DesiredFee = jxutils.StandardPrice2Int(utils.Interface2Float64WithDefault(result["deliverFee"], 0.0) + + utils.Interface2Float64WithDefault(result["vipDeliveryFeeDiscount"], 0.0)) } order.Status = model.WaybillStatusAccepted } else if msg.MsgType == elmapi.MsgTypeWaybillCourierArrived {