This commit is contained in:
laodaming 2023-09-25 15:49:59 +08:00
parent d8d91e9270
commit 29c7dc54e3
5 changed files with 6 additions and 5 deletions

View File

@ -23,12 +23,13 @@ type FsProductModel3d struct {
Status *int64 `gorm:"default:0;" json:"status"` // 状态位 显示 删除
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
OptionTemplate *int64 `gorm:"default:0;" json:"option_template"` // 配件绑定的公共模板
FittingPrice *int64 `gorm:"default:0;" json:"fitting_price"` // 仅配件用,配件的价格, 单位:美分
Price *int64 `gorm:"default:0;" json:"price"` //
Sku *string `gorm:"default:'';" json:"sku"` // sku
IsHot *int64 `gorm:"default:0;" json:"is_hot"` // 是否热门
IsCloudRender *int64 `gorm:"default:0;" json:"is_cloud_render"` // 是否设置为云渲染模型
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
StepPrice *[]byte `gorm:"default:'';" json:"step_price"` //
PackedUnit *int64 `gorm:"default:0;" json:"packed_unit"` //
}
type FsProductModel3dModel struct {
db *gorm.DB

View File

@ -111,7 +111,7 @@ func (l *GetFittingByPidLogic) GetFittingByPid(req *types.GetFittingByPidReq, us
Id: fitting.Id,
MaterialImg: materialImg,
Title: *fitting.Title,
Price: *fitting.FittingPrice,
Price: *fitting.Price,
ModelInfo: modelInfo,
IsPopular: *fitting.IsHot > 0,
})

View File

@ -93,7 +93,7 @@ func (l *CalculateCartPriceLogic) CalculateCartPrice(req *types.CalculateCartPri
}
mapFitting := make(map[int64]int64)
for _, v := range fittingList {
mapFitting[v.Id] = *v.FittingPrice
mapFitting[v.Id] = *v.Price
}
//开始计算价格
calculateResultList := make([]types.CalculateResultItem, 0, len(req.CalculateList))

View File

@ -109,7 +109,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
fittingPrice := int64(0)
if *cart.FittingId > 0 {
if curFittingInfo, ok := mapModel[*cart.FittingId]; ok {
fittingPrice = *curFittingInfo.FittingPrice
fittingPrice = *curFittingInfo.Price
} else {
return resp.SetStatusWithMessage(basic.CodeServiceErr, fmt.Sprintf("cart contain some one witch lose fitting:%d", *cart.FittingId))
}

View File

@ -838,7 +838,7 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
}
/* 计算价格 */
productPrice, productTotalPrice, stepNum, stepPrice, err := NewShoppingCart(tx, nil, nil).CaculateCartPrice(*shoppingCart.PurchaseQuantity, shoppingCartProductPrice, *shoppingCart.ShoppingCartProductModel3dFitting.FittingPrice)
productPrice, productTotalPrice, stepNum, stepPrice, err := NewShoppingCart(tx, nil, nil).CaculateCartPrice(*shoppingCart.PurchaseQuantity, shoppingCartProductPrice, *shoppingCart.ShoppingCartProductModel3dFitting.Price)
if err != nil {
errorCode = *basic.CodeErrOrderCreatProductPriceAbsent
errorCode.Message = "create order failed, step price of product '" + shoppingCartSnapshot.ProductInfo.ProductName + "'is failed"