完善定价与套餐关联表结构

This commit is contained in:
2026-03-24 16:25:21 +08:00
parent c9995ef566
commit 5ffa151f58
28 changed files with 1550 additions and 112 deletions

View 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))
}