diff --git a/model/gmodel/fs_order_logic.go b/model/gmodel/fs_order_logic.go index a6fdb2b2..19bae9ae 100644 --- a/model/gmodel/fs_order_logic.go +++ b/model/gmodel/fs_order_logic.go @@ -95,22 +95,23 @@ type OrderStatus struct { // 订单商品 type OrderProduct struct { - TotalPrice AmountInfo `json:"amount"` // 商品总价 - ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间 - PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量 - ProductID int64 `json:"product_id"` // 商品ID - ProductName string `json:"product_name"` // 商品名称 - ItemPrice AmountInfo `json:"product_price"` // 商品单价 - ProductSnapshot interface{} `json:"product_snapshot"` // 商品快照 - ShoppingCartSnapshot *FsShoppingCart `json:"shopping_cart_snapshot"` // 购物车快照 - ProductCover string `json:"product_cover"` // 商品封面 - ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面 - ProductSn string `json:"product_sn"` // 商品编码 - DiyInformation *UserDiyInformation `json:"diy_information"` - SizeInfo *OrderProductSizeInfo `json:"size_info"` - FittingInfo *OrderProductFittingInfo `json:"fitting_info"` - StepNum []int `json:"step_num"` // 阶梯数量 - IsHighlyCustomized int64 `json:"is_highly_customized"` + TotalPrice AmountInfo `json:"amount"` // 商品总价 + ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间 + PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量 + ProductID int64 `json:"product_id"` // 商品ID + ProductName string `json:"product_name"` // 商品名称 + ItemPrice AmountInfo `json:"product_price"` // 商品单价 + ProductSnapshot interface{} `json:"product_snapshot"` // 商品快照 + ShoppingCartSnapshot *FsShoppingCart `json:"shopping_cart_snapshot"` // 购物车快照 + ShoppingCartSnapshotInfo map[string]interface{} `json:"shopping_cart_snapshot_info"` // 商品封面 + ProductCover string `json:"product_cover"` // 商品封面 + ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面 + ProductSn string `json:"product_sn"` // 商品编码 + DiyInformation *UserDiyInformation `json:"diy_information"` + SizeInfo *OrderProductSizeInfo `json:"size_info"` + FittingInfo *OrderProductFittingInfo `json:"fitting_info"` + StepNum []int `json:"step_num"` // 阶梯数量 + IsHighlyCustomized int64 `json:"is_highly_customized"` } type PurchaseQuantity struct { Current interface{} `json:"current"` diff --git a/server/product/internal/logic/calculateproductpricelogic.go b/server/product/internal/logic/calculateproductpricelogic.go index 6c5cf0e4..2da76ec1 100644 --- a/server/product/internal/logic/calculateproductpricelogic.go +++ b/server/product/internal/logic/calculateproductpricelogic.go @@ -84,7 +84,7 @@ func (l *CalculateProductPriceLogic) CalculateProductPrice(req *types.CalculateP logx.Error(err) return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to calculate product price ") } - return resp.SetStatus(basic.CodeOK, "success", types.CalculateProductPriceRsp{ + return resp.SetStatusWithMessage(basic.CodeOK, "success", types.CalculateProductPriceRsp{ ItemPrice: format.CentitoDollar(itemPrice, 3), TotalPrice: format.CentitoDollarWithNoHalfAdjust(totalPrice, 2), PurchaseQuantity: req.PurchaseQuantity, diff --git a/service/repositories/order.go b/service/repositories/order.go index be8c51d4..ce264e79 100644 --- a/service/repositories/order.go +++ b/service/repositories/order.go @@ -1076,6 +1076,43 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel orderDetail.OrderProduct[orderProductKey].TotalPrice = order.GetAmountInfoFormat(&orderProduct.TotalPrice) orderDetail.OrderProduct[orderProductKey].PurchaseQuantity = order.GetPurchaseQuantity(&orderProduct.PurchaseQuantity) orderDetail.OrderProduct[orderProductKey].ProductSnapshot = nil + var snapshot map[string]interface{} + if orderDetail.OrderProduct[orderProductKey].ShoppingCartSnapshot.Snapshot != nil { + json.Unmarshal([]byte(*orderDetail.OrderProduct[orderProductKey].ShoppingCartSnapshot.Snapshot), &snapshot) + } + snapshotfittingInfoData, snapshotfittingInfoEx := snapshot["fitting_info"] + var snapshotfittingInfoJson map[string]interface{} + if snapshotfittingInfoEx { + snapshotfittingInfo := snapshotfittingInfoData.(map[string]interface{}) + snapshotfittingInfoJsonData, snapshotfittingInfoJsonEx := snapshotfittingInfo["fitting_json"] + if snapshotfittingInfoJsonEx { + var snapshotfittingInfoJson map[string]interface{} + json.Unmarshal([]byte(snapshotfittingInfoJsonData.(string)), &snapshotfittingInfoJson) + } + } + snapshot["fitting_info"] = snapshotfittingInfoJson + snapshotModelInfoData, snapshotModelInfoEx := snapshot["model_info"] + var snapshotModelInfoJson map[string]interface{} + if snapshotModelInfoEx { + snapshotModelInfo := snapshotModelInfoData.(map[string]interface{}) + snapshotModelInfoJsonData, snapshotModelInfoJsonEx := snapshotModelInfo["model_json"] + if snapshotModelInfoJsonEx { + json.Unmarshal([]byte(snapshotModelInfoJsonData.(string)), &snapshotModelInfoJson) + } + } + snapshot["model_info"] = snapshotModelInfoJson + snapshotTemplateInfoData, snapshotTemplateInfoEx := snapshot["template_info"] + var snapshotTemplateInfoJson map[string]interface{} + if snapshotTemplateInfoEx { + snapshotTemplateInfo := snapshotTemplateInfoData.(map[string]interface{}) + snapshotTemplateInfoJsonData, snapshotTemplateInfoJsonEx := snapshotTemplateInfo["template_json"] + if snapshotTemplateInfoJsonEx { + json.Unmarshal([]byte(snapshotTemplateInfoJsonData.(string)), &snapshotTemplateInfoJson) + } + } + snapshot["template_info"] = snapshotTemplateInfoJson + orderDetail.OrderProduct[orderProductKey].ShoppingCartSnapshot.Snapshot = nil + orderDetail.OrderProduct[orderProductKey].ShoppingCartSnapshotInfo = snapshot } orderDetail.OrderInfo.StatusLink = order.GetOrderStatusLinkUser(orderDetail.OrderInfo.DeliveryMethod, orderDetail.OrderInfo.StatusLink) orderDetail.OrderAmount.Deposit.PayAmount = order.GetAmountInfoFormat(&orderDetail.OrderAmount.Deposit.PayAmount)