33 lines
1.4 KiB
Go
33 lines
1.4 KiB
Go
package models
|
||
|
||
import (
|
||
"platform/web/core"
|
||
|
||
"github.com/shopspring/decimal"
|
||
)
|
||
|
||
// ProductSku 产品SKU表
|
||
type ProductSku struct {
|
||
core.Model
|
||
ProductID int32 `json:"product_id" gorm:"column:product_id"` // 产品ID
|
||
DiscountId int32 `json:"discount_id" gorm:"column:discount_id"` // 折扣,0 - 1 的小数,表示 xx 折
|
||
Code string `json:"code" gorm:"column:code"` // SSKU 代码:格式为 key=value,key=value,...,其中,key:value 是 SKU 的属性,多个属性用逗号分隔
|
||
Name string `json:"name" gorm:"column:name"` // SKU 可读名称
|
||
Price decimal.Decimal `json:"price" gorm:"column:price"` // 定价
|
||
PriceMin decimal.Decimal `json:"price_min" gorm:"column:price_min"` // 最低价格
|
||
Status SkuStatus `json:"status" gorm:"column:status"` // SKU 状态:0-禁用,1-正常
|
||
Sort int32 `json:"sort" gorm:"column:sort"` // 排序
|
||
CountMin int32 `json:"count_min" gorm:"column:count_min"` // 最小购买数量
|
||
|
||
Product *Product `json:"product,omitempty" gorm:"foreignKey:ProductID"`
|
||
Discount *ProductDiscount `json:"discount,omitempty" gorm:"foreignKey:DiscountId"`
|
||
}
|
||
|
||
// SkuStatus SKU 状态
|
||
type SkuStatus int32
|
||
|
||
const (
|
||
SkuStatusDisabled SkuStatus = 0 // 禁用
|
||
SkuStatusEnabled SkuStatus = 1 // 正常
|
||
)
|