This commit is contained in:
2023-12-25 10:28:31 +08:00
parent dceaa0aedf
commit 97b8a21254
2 changed files with 33 additions and 0 deletions
+10
View File
@@ -21,6 +21,7 @@ type ProductPlatformDto struct {
RetailUnit string `json:"retail_unit"` // 零售单位
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
Stock uint `json:"stock"` // 现有库存
}
// GetProductPlatformDto 平台商品详情
@@ -76,3 +77,12 @@ func GetProductPlatformListDto(m []*model.ProductPlatform) []*ProductPlatformDto
return responses
}
// LoadProductAmount 加载商品库存
func (r *ProductPlatformDto) LoadProductAmount(quantity int) *ProductPlatformDto {
if quantity > 0 {
r.Stock = uint(quantity)
}
return r
}