- Interface2FloatWithDefault to Interface2Float64WithDefault

This commit is contained in:
gazebo
2019-04-02 14:33:31 +08:00
parent 38b32cc10d
commit c5d1eb78c5
6 changed files with 11 additions and 11 deletions

View File

@@ -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)
}

View File

@@ -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, "")
}

View File

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

View File

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

View File

@@ -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日饿了么迁移到饿百后这个字段发生了变化

View File

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