From 5f4af9ced03bd6340ae71664164d7a4f4b242d55 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 26 Jul 2018 16:49:21 +0800 Subject: [PATCH] - fixed some price bug. --- business/controller/elm/order.go | 2 +- business/controller/mtps/waybill.go | 24 ++++++++-------- business/controller/order_legacy.go | 43 +++++++++++++++-------------- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/business/controller/elm/order.go b/business/controller/elm/order.go index e0976249e..020f00c28 100644 --- a/business/controller/elm/order.go +++ b/business/controller/elm/order.go @@ -181,7 +181,7 @@ func (c *OrderController) GetOrder(orderID string) (order *model.GoodsOrder, err SkuID: int(utils.Str2Int64WithDefault(utils.Interface2String(product["extendCode"]), 0)), VendorSkuID: utils.Int64ToStr(utils.MustInterface2Int64(product["skuId"])), SkuName: product["name"].(string), - SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["userPrice"])), + SalePrice: jxutils.StandardPrice2Int(utils.MustInterface2Float64(product["price"])), // todo 这个其实不是用户实付价,但之前用的userPrice取出来是空,暂时先用到 Weight: int(math.Round(utils.Interface2FloatWithDefault(product["weight"], 0.0))), } order.Skus = append(order.Skus, sku) diff --git a/business/controller/mtps/waybill.go b/business/controller/mtps/waybill.go index 66a1c0671..e9fa669da 100644 --- a/business/controller/mtps/waybill.go +++ b/business/controller/mtps/waybill.go @@ -148,18 +148,18 @@ func (c *WaybillController) CreateWaybill(order *model.GoodsOrder) (err error) { // 忽略坐标转换错误,即使是转换出错,也只能当成转换成功来处理,底层会有错误日志输出 lngFloat, latFloat, _ := jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType) billParams := &mtpsapi.CreateOrderByShopParam{ - OrderID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID), - DeliveryServiceCode: mtpsapi.DeliveryServiceCodeRapid, - ReceiverName: order.ConsigneeName, - ReceiverAddress: order.ConsigneeAddress, - ReceiverPhone: order.ConsigneeMobile, - CoordinateType: model.CoordinateTypeMars, - ReceiverLng: jxutils.StandardCoordinate2Int(lngFloat), - ReceiverLat: jxutils.StandardCoordinate2Int(latFloat), - GoodsValue: jxutils.IntPrice2Standard(order.SalePrice), // todo 超价处理 - GoodsWeight: float64(order.Weight) / 1000, - ExpectedDeliveryTime: order.ExpectedDeliveredTime.Unix(), - OrderType: mtpsapi.OrderTypeASAP, + OrderID: jxutils.ComposeUniversalOrderID(order.VendorOrderID, order.VendorID), + DeliveryServiceCode: mtpsapi.DeliveryServiceCodeRapid, + ReceiverName: order.ConsigneeName, + ReceiverAddress: order.ConsigneeAddress, + ReceiverPhone: order.ConsigneeMobile, + CoordinateType: model.CoordinateTypeMars, + ReceiverLng: jxutils.StandardCoordinate2Int(lngFloat), + ReceiverLat: jxutils.StandardCoordinate2Int(latFloat), + GoodsValue: jxutils.IntPrice2Standard(order.SalePrice), // todo 超价处理 + GoodsWeight: float64(order.Weight) / 1000, + // ExpectedDeliveryTime: order.ExpectedDeliveredTime.Unix(), + OrderType: mtpsapi.OrderTypeASAP, } if billParams.DeliveryID, err = c.getDeliveryID(order, db); err == nil { if billParams.ShopID, err = c.getMTPSShopID(order, db); err == nil { diff --git a/business/controller/order_legacy.go b/business/controller/order_legacy.go index 7503976d0..a6e61b179 100644 --- a/business/controller/order_legacy.go +++ b/business/controller/order_legacy.go @@ -148,27 +148,28 @@ func (c *OrderController) legacyWriteJxOrder(order *model.GoodsOrder, db orm.Orm orderStatus = JX_ORDER_STATUS_PICKING } jxorder := &legacymodel.Jxorder2{ - VenderId: int8(order.VendorID), - OrderId: utils.Str2Int64(order.VendorOrderID), - JxStoreId: utils.Int2Str(jxutils.GetJxStoreIDFromOrder(order)), - JxStoreName: order.StoreName, - OrderNum: order.OrderSeq, - OrderStatus: orderStatus, - OrderStatusTime: utils.Time2Str(order.StatusTime), - BusinessTag: businessTags, - SkuCount: order.SkuCount, - OrderBuyerRemark: order.BuyerComment, - BuyerFullName: order.ConsigneeName, - BuyerFullAddress: order.ConsigneeAddress, - BuyerMobile: order.ConsigneeMobile, - BuyerCoordType: legacyMapCoordinateType(order.CoordinateType), - BuyerLng: jxutils.IntCoordinate2Standard(order.ConsigneeLng), - BuyerLat: jxutils.IntCoordinate2Standard(order.ConsigneeLat), - CityName: "all", - OrderStartTime: utils.Time2Str(order.StatusTime), - JdStoreId: order.VendorStoreID, - OrderTotalMoney: int(order.SalePrice), - OrderDiscountMoney: int(order.SalePrice - order.ActualPayPrice), + VenderId: int8(order.VendorID), + OrderId: utils.Str2Int64(order.VendorOrderID), + JxStoreId: utils.Int2Str(jxutils.GetJxStoreIDFromOrder(order)), + JxStoreName: order.StoreName, + OrderNum: order.OrderSeq, + OrderStatus: orderStatus, + OrderStatusTime: utils.Time2Str(order.StatusTime), + BusinessTag: businessTags, + SkuCount: order.SkuCount, + OrderBuyerRemark: order.BuyerComment, + BuyerFullName: order.ConsigneeName, + BuyerFullAddress: order.ConsigneeAddress, + BuyerMobile: order.ConsigneeMobile, + BuyerCoordType: legacyMapCoordinateType(order.CoordinateType), + BuyerLng: jxutils.IntCoordinate2Standard(order.ConsigneeLng), + BuyerLat: jxutils.IntCoordinate2Standard(order.ConsigneeLat), + CityName: "all", + OrderStartTime: utils.Time2Str(order.StatusTime), + JdStoreId: order.VendorStoreID, + OrderTotalMoney: int(order.SalePrice), + OrderDiscountMoney: int(order.SalePrice - order.ActualPayPrice), + OrderBuyerPayableMoney: int(order.ActualPayPrice), // DeliveryPackageWeight: float64(order.Weight) / 1000, } if order.VendorID == model.VendorIDELM {