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

This commit is contained in:
laodaming 2023-09-25 11:17:03 +08:00
commit 02b3788dc9
3 changed files with 20 additions and 3 deletions

View File

@ -97,7 +97,7 @@ type OrderStatus struct {
type OrderProduct struct {
TotalPrice AmountInfo `json:"amount"` // 商品总价
ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间
PurchaseQuantity int64 `json:"purchase_quantity"` // 购买数量
PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量
ProductID int64 `json:"product_id"` // 商品ID
ProductName string `json:"product_name"` // 商品名称
ItemPrice AmountInfo `json:"product_price"` // 商品单价
@ -112,6 +112,10 @@ type OrderProduct struct {
StepNum []int `json:"step_num"` // 阶梯数量
IsHighlyCustomized int64 `json:"is_highly_customized"`
}
type PurchaseQuantity struct {
Current interface{} `json:"current"`
Initiate interface{} `json:"initiate"`
}
type OrderProductSizeInfo struct {
SizeID int64 `json:"size_id"`

View File

@ -863,7 +863,10 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
OriginalCurrency: in.OriginalCurrency,
}),
ExpectedDeliveryTime: &in.ExpectedDeliveryTime,
PurchaseQuantity: *shoppingCart.PurchaseQuantity,
PurchaseQuantity: gmodel.PurchaseQuantity{
Current: *shoppingCart.PurchaseQuantity,
Initiate: *shoppingCart.PurchaseQuantity,
},
ProductID: *shoppingCart.ProductId,
ProductCover: *shoppingCart.ShoppingCartProduct.Cover,
ProductCoverMetadata: productCoverMetadata,
@ -1032,7 +1035,8 @@ func (d *defaultOrder) OrderDetailHandler(ctx context.Context, orderInfo *gmodel
if original == 1 {
for orderProductKey, orderProduct := range orderDetail.OrderProduct {
orderDetail.OrderProduct[orderProductKey].TotalPrice = order.GetAmountInfoFormat(&orderProduct.TotalPrice)
orderDetail.OrderProduct[orderProductKey].ItemPrice = order.GetAmountInfoFormat(&orderProduct.ItemPrice)
orderDetail.OrderProduct[orderProductKey].TotalPrice = order.GetAmountInfoFormat(&orderProduct.TotalPrice)
orderDetail.OrderProduct[orderProductKey].PurchaseQuantity = order.GetPurchaseQuantity(&orderProduct.PurchaseQuantity)
orderDetail.OrderProduct[orderProductKey].ShoppingCartSnapshot = nil
orderDetail.OrderProduct[orderProductKey].ProductSnapshot = nil
}

View File

@ -5,6 +5,7 @@ import (
"fusenapi/constants"
"fusenapi/model/gmodel"
"fusenapi/utils/format"
"strconv"
"time"
)
@ -112,6 +113,14 @@ func GetAmountInfoFormat(req *gmodel.AmountInfo) gmodel.AmountInfo {
}
}
// 处理商品数量
func GetPurchaseQuantity(req *gmodel.PurchaseQuantity) gmodel.PurchaseQuantity {
return gmodel.PurchaseQuantity{
Initiate: strconv.FormatInt(int64(req.Initiate.(float64)), 10),
Current: strconv.FormatInt(int64(req.Current.(float64)), 10),
}
}
// 生成订单编号
func GenerateOrderNumber() string {
t := time.Now()