完善定价与套餐关联表结构
This commit is contained in:
19
web/models/product_discount.go
Normal file
19
web/models/product_discount.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/core"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
// ProductDiscount 产品折扣表
|
||||
type ProductDiscount struct {
|
||||
core.Model
|
||||
Name string `json:"name" gorm:"column:name"` // 产品名称
|
||||
Discount int32 `json:"discount" gorm:"column:discount"` // 产品折扣
|
||||
}
|
||||
|
||||
func (pd ProductDiscount) Decimal() decimal.Decimal {
|
||||
return decimal.NewFromInt32(pd.Discount).
|
||||
Div(decimal.NewFromInt32(100))
|
||||
}
|
||||
Reference in New Issue
Block a user