package model import "time" // Plan 定价计划模型(支持买断/订阅多档位) // Logan.Li type Plan struct { ID uint `json:"id" gorm:"primaryKey"` ProductID uint `json:"product_id"` Product Product `json:"product,omitempty" gorm:"foreignKey:ProductID"` Name string `json:"name" gorm:"size:100;not null"` // 如:个人版、专业版、企业版 PlanType string `json:"plan_type" gorm:"size:50;not null"` // perpetual / monthly / yearly / lifetime Price float64 `json:"price" gorm:"type:decimal(10,2);not null"` Currency string `json:"currency" gorm:"size:3;default:'USD'"` // USD / CNY Duration int `json:"duration" gorm:"default:0"` // 天数:0=永久/买断,30=月,365=年 MaxDevices int `json:"max_devices" gorm:"default:1"` // 允许激活设备数 Features string `json:"features" gorm:"type:text"` // JSON 功能清单 SortOrder int `json:"sort_order" gorm:"default:0"` Status int `json:"status" gorm:"default:1"` // 1: 上架, 0: 下架 CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // TableName 指定表名 // Logan.Li func (Plan) TableName() string { return "plans" }