tg_red_packet.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package entity
  2. import (
  3. "github.com/shopspring/decimal"
  4. "time"
  5. )
  6. // TgRedPacket Telegram红包表
  7. type TgRedPacket struct {
  8. MysqlBaseModel
  9. PacketNo string `json:"packetNo" gorm:"type:varchar(64);uniqueIndex;comment:红包编号(唯一);NOT NULL"`
  10. UserId int64 `json:"userId" gorm:"index;comment:发红包用户ID;NOT NULL"`
  11. GroupId string `json:"groupId" gorm:"type:varchar(128);index;comment:Telegram群组ID;NOT NULL"`
  12. PacketType int `json:"packetType" gorm:"type:tinyint;comment:红包类型: 1=普通红包, 2=手气红包;NOT NULL"`
  13. TotalAmount decimal.Decimal `json:"totalAmount" gorm:"type:decimal(25,8);comment:红包总金额;NOT NULL"`
  14. TotalCount int `json:"totalCount" gorm:"type:int;comment:红包总个数;NOT NULL"`
  15. GrabbedCount int `json:"grabbedCount" gorm:"type:int;default:0;comment:已抢个数"`
  16. GrabbedAmount decimal.Decimal `json:"grabbedAmount" gorm:"type:decimal(25,8);default:0;comment:已抢金额"`
  17. RemainCount int `json:"remainCount" gorm:"type:int;comment:剩余个数;NOT NULL"`
  18. RemainAmount decimal.Decimal `json:"remainAmount" gorm:"type:decimal(25,8);comment:剩余金额;NOT NULL"`
  19. Symbol string `json:"symbol" gorm:"type:varchar(20);default:'VND';comment:币种"`
  20. MaxGrabAmount decimal.Decimal `json:"maxGrabAmount" gorm:"type:decimal(25,8);default:0;comment:单人最大可领取金额(0=不限制)"`
  21. Lang string `json:"lang" gorm:"type:varchar(10);default:'vi';comment:消息语言: vi=越南语, id=印尼语, en=英语, zh=中文"`
  22. MessageId int64 `json:"messageId" gorm:"type:bigint;comment:Telegram消息ID"`
  23. BlessingWords string `json:"blessingWords" gorm:"type:varchar(255);comment:祝福语"`
  24. Status int `json:"status" gorm:"type:tinyint;default:1;index;comment:状态: 1=进行中, 2=已抢完, 3=已过期"`
  25. ExpireAt time.Time `json:"expireAt" gorm:"type:timestamp;comment:过期时间(24小时);NOT NULL"`
  26. CompletedAt *time.Time `json:"completedAt" gorm:"type:timestamp;comment:完成时间"`
  27. }
  28. func (*TgRedPacket) TableName() string {
  29. return ModelPrefix + "tg_red_packet"
  30. }
  31. func (*TgRedPacket) Comment() string {
  32. return "Telegram红包表"
  33. }
  34. func NewTgRedPacket() *TgRedPacket {
  35. return &TgRedPacket{}
  36. }