package model import "time" // CustomerEntitlement 客户权益记录(防重复购买的核心表) // Logan.Li type CustomerEntitlement struct { ID uint `json:"id" gorm:"primaryKey"` CustomerID uint `json:"customer_id"` Customer Customer `json:"customer,omitempty" gorm:"foreignKey:CustomerID"` ProductID uint `json:"product_id"` Product Product `json:"product,omitempty" gorm:"foreignKey:ProductID"` PlanID uint `json:"plan_id"` Plan Plan `json:"plan,omitempty" gorm:"foreignKey:PlanID"` LicenseID uint `json:"license_id"` LicenseKey string `json:"license_key" gorm:"size:100"` PlanType string `json:"plan_type" gorm:"size:50"` // perpetual / monthly / yearly / lifetime Status string `json:"status" gorm:"size:20;default:'active'"` // active / expired / revoked ValidFrom time.Time `json:"valid_from"` ValidUntil *time.Time `json:"valid_until,omitempty"` // 买断/永久为 null Renewable bool `json:"renewable" gorm:"default:true"` // 订阅到期后是否可续费 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // TableName 指定表名 // Logan.Li func (CustomerEntitlement) TableName() string { return "customer_entitlements" }