package model import ( "time" "gorm.io/gorm" ) // CommissionRecord 分佣记录模型 // 记录分佣的冻结、解冻、发放状态 type CommissionRecord struct { gorm.Model BaseModel `gorm:"embedded"` AgentID uint `gorm:"column:agent_id;index;not null;comment:代理用户ID" json:"agent_id"` ShopID uint `gorm:"column:shop_id;index;comment:店铺ID(佣金主要跟着店铺走)" json:"shop_id"` OrderID uint `gorm:"column:order_id;index;not null;comment:订单ID" json:"order_id"` RuleID uint `gorm:"column:rule_id;index;not null;comment:分佣规则ID" json:"rule_id"` CommissionType string `gorm:"column:commission_type;type:varchar(50);not null;comment:分佣类型 one_time-一次性 long_term-长期" json:"commission_type"` Amount int64 `gorm:"column:amount;type:bigint;not null;comment:分佣金额(分为单位)" json:"amount"` BalanceAfter int64 `gorm:"column:balance_after;type:bigint;default:0;comment:入账后佣金余额(分)" json:"balance_after"` Status int `gorm:"column:status;type:int;default:1;not null;comment:状态 1-已冻结 2-解冻中 3-已发放 4-已失效" json:"status"` UnfrozenAt *time.Time `gorm:"column:unfrozen_at;comment:解冻时间" json:"unfrozen_at"` ReleasedAt *time.Time `gorm:"column:released_at;comment:发放时间" json:"released_at"` } // TableName 指定表名 func (CommissionRecord) TableName() string { return "tb_commission_record" }