Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson 2023-09-26 12:24:14 +08:00
commit 407ba29319
3 changed files with 55 additions and 17 deletions

View File

@ -103,6 +103,7 @@ type OrderProduct struct {
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"` // 商品编码

View File

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

View File

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