Files
cpdaily_xiaozhushou/backed/internal/model/cdk_code.go
T
becomer 2e2c161770 feat: init cpdaily-xiaozhushou with blue-green deploy
- backed/: Go Fiber backend with cpdaily integration
- frondend/: Vue 3 + Vite frontend
- Dockerfile: multi-stage build (Node → Go → Alpine)
- deploy/docker-compose.yml: production compose file
- .woodpecker/build.yml: CI/CD with blue-green zero-downtime deploy
- /health endpoint for deployment health checks
- Port 8884/8885 blue-green swap via 1Panel OpenResty
2026-07-03 15:37:55 +08:00

23 lines
1.0 KiB
Go

package model
import "time"
// CDKCode CDK码
type CDKCode struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
Code string `gorm:"type:varchar(32);uniqueIndex;not null" json:"code"`
Price float64 `gorm:"type:decimal(10,2);not null" json:"price"` // 售价(用户端价格)
CostPrice float64 `gorm:"type:decimal(10,2);not null" json:"costPrice"` // 成本价(系统底价)
AgentID uint `gorm:"not null;index" json:"agentId"` // 生成此CDK的代理
MaxRuns int `gorm:"default:1;not null" json:"maxRuns"` // 可运行次数
Status string `gorm:"type:varchar(16);not null;default:unused" json:"status"` // unused / used / disabled
UserID *uint `gorm:"index" json:"userId"` // 最近兑换用户
UsedAt *time.Time `json:"usedAt"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
func (CDKCode) TableName() string {
return "cdk_codes"
}