package entity import ( "github.com/shopspring/decimal" "time" ) // TgRedPacketConfig Telegram红包配置表(定时红包、管理员配置) type TgRedPacketConfig struct { MysqlBaseModel ConfigName string `json:"configName" gorm:"type:varchar(128);comment:配置名称;NOT NULL"` ConfigType int `json:"configType" gorm:"type:tinyint;comment:配置类型: 1=定时红包, 2=手动触发;NOT NULL"` GroupId string `json:"groupId" gorm:"type:varchar(128);index;comment:Telegram群组ID;NOT NULL"` GroupName string `json:"groupName" gorm:"type:varchar(255);comment:群组名称"` PacketType int `json:"packetType" gorm:"type:tinyint;comment:红包类型: 1=普通红包, 2=手气红包;NOT NULL"` TotalAmount decimal.Decimal `json:"totalAmount" gorm:"type:decimal(25,8);comment:红包总金额;NOT NULL"` TotalCount int `json:"totalCount" gorm:"type:int;comment:红包总个数;NOT NULL"` Symbol string `json:"symbol" gorm:"type:varchar(20);default:'VND';comment:币种"` ExpireMinutes int `json:"expireMinutes" gorm:"type:int;default:10;comment:红包过期时间(分钟)"` MaxGrabAmount decimal.Decimal `json:"maxGrabAmount" gorm:"type:decimal(25,8);default:0;comment:单人最大可领取金额(0=不限制)"` Lang string `json:"lang" gorm:"type:varchar(10);default:'vi';comment:消息语言: vi=越南语, id=印尼语, en=英语, zh=中文"` BlessingWords string `json:"blessingWords" gorm:"type:varchar(255);comment:祝福语"` // 定时任务相关字段(仅 configType=1 时使用) CronExpr string `json:"cronExpr" gorm:"type:varchar(128);comment:Cron表达式(如: 0 0 12 * * *)"` TimeZone string `json:"timeZone" gorm:"type:varchar(64);default:'Asia/Ho_Chi_Minh';comment:时区"` StartDate *time.Time `json:"startDate" gorm:"type:timestamp;comment:开始日期"` EndDate *time.Time `json:"endDate" gorm:"type:timestamp;comment:结束日期"` // 状态控制 Status int `json:"status" gorm:"type:tinyint;default:1;index;comment:状态: 1=启用, 2=禁用, 3=已删除"` LastExecTime *time.Time `json:"lastExecTime" gorm:"type:timestamp;comment:上次执行时间"` NextExecTime *time.Time `json:"nextExecTime" gorm:"type:timestamp;comment:下次执行时间"` ExecCount int `json:"execCount" gorm:"type:int;default:0;comment:已执行次数"` // 创建者信息 CreatorId int64 `json:"creatorId" gorm:"comment:创建者ID"` CreatorName string `json:"creatorName" gorm:"type:varchar(128);comment:创建者名称"` Remark string `json:"remark" gorm:"type:varchar(500);comment:备注"` } func (*TgRedPacketConfig) TableName() string { return ModelPrefix + "tg_red_packet_config" } func (*TgRedPacketConfig) Comment() string { return "Telegram红包配置表" } func NewTgRedPacketConfig() *TgRedPacketConfig { return &TgRedPacketConfig{} }