fix fbs encoding
This commit is contained in:
@ -88,7 +88,6 @@ func makeDomainGoodItem(builder *flatbuffers.Builder, in entity.GoodsItem) flatb
|
||||
h = float32(in.Sizes.Height.AdjustTo(entity.DimensionKindCentimeter).Value)
|
||||
l = float32(in.Sizes.Length.AdjustTo(entity.DimensionKindCentimeter).Value)
|
||||
}
|
||||
sizes := CreateDimensions(builder, w, h, l)
|
||||
|
||||
GoodItemStart(builder)
|
||||
GoodItemAddSku(builder, sku)
|
||||
@ -106,9 +105,9 @@ func makeDomainGoodItem(builder *flatbuffers.Builder, in entity.GoodsItem) flatb
|
||||
GoodItemAddTariff(builder, float32(in.TariffPrice))
|
||||
GoodItemAddCart(builder, int64(in.Cart))
|
||||
GoodItemAddStock(builder, int16(in.Stock))
|
||||
GoodItemAddSizes(builder, sizes)
|
||||
GoodItemAddParameters(builder, parameters)
|
||||
GoodItemAddCreatedAt(builder, in.CreatedAt.Unix())
|
||||
GoodItemAddSizes(builder, CreateDimensions(builder, w, h, l))
|
||||
|
||||
return GoodItemEnd(builder)
|
||||
}
|
||||
@ -145,10 +144,13 @@ func ParseGoodsItem(data []byte) (item entity.GoodsItem, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
var w, h, l float64
|
||||
sizes := itemFBS.Sizes(nil)
|
||||
w := float64(sizes.Width())
|
||||
h := float64(sizes.Height())
|
||||
l := float64(sizes.Length())
|
||||
if sizes != nil {
|
||||
w = float64(sizes.Width())
|
||||
h = float64(sizes.Height())
|
||||
l = float64(sizes.Length())
|
||||
}
|
||||
|
||||
item.Sizes = entity.GoodsItemSize{
|
||||
Width: entity.NewMilimeterDimension(w),
|
||||
|
||||
Reference in New Issue
Block a user