完善定价与套餐关联表结构
This commit is contained in:
@@ -11,10 +11,12 @@ type Resource struct {
|
||||
ResourceNo *string `json:"resource_no,omitempty" gorm:"column:resource_no"` // 套餐编号
|
||||
Active bool `json:"active" gorm:"column:active"` // 套餐状态
|
||||
Type ResourceType `json:"type" gorm:"column:type"` // 套餐类型:1-短效动态,2-长效动态
|
||||
Code string `json:"code" gorm:"column:code"` // 产品编码
|
||||
|
||||
User *User `json:"user,omitempty" gorm:"foreignKey:UserID"`
|
||||
Short *ResourceShort `json:"short,omitempty" gorm:"foreignKey:ResourceID"`
|
||||
Long *ResourceLong `json:"long,omitempty" gorm:"foreignKey:ResourceID"`
|
||||
User *User `json:"user,omitempty" gorm:"foreignKey:UserID"`
|
||||
Short *ResourceShort `json:"short,omitempty" gorm:"foreignKey:ResourceID"`
|
||||
Long *ResourceLong `json:"long,omitempty" gorm:"foreignKey:ResourceID"`
|
||||
Product *Product `json:"product,omitempty" gorm:"foreignKey:Code;references:Code"`
|
||||
}
|
||||
|
||||
// ResourceType 套餐类型枚举
|
||||
@@ -25,7 +27,18 @@ const (
|
||||
ResourceTypeLong ResourceType = 2 // 长效动态
|
||||
)
|
||||
|
||||
// ResourceLongType 套餐计费模式枚举
|
||||
func (t ResourceType) Code() string {
|
||||
switch t {
|
||||
case ResourceTypeShort:
|
||||
return "short"
|
||||
case ResourceTypeLong:
|
||||
return "long"
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// ResourceMode 套餐计费模式枚举
|
||||
type ResourceMode int
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user