tg_bind_token.go 990 B

1234567891011121314151617181920212223242526
  1. package entity
  2. import "time"
  3. // TgBindToken Telegram绑定令牌表
  4. type TgBindToken struct {
  5. MysqlBaseModel
  6. Token string `json:"token" gorm:"type:varchar(64);uniqueIndex;comment:绑定令牌;NOT NULL"`
  7. TelegramId int64 `json:"telegramId" gorm:"index;comment:Telegram用户ID;NOT NULL"`
  8. TelegramUsername string `json:"telegramUsername" gorm:"type:varchar(255);comment:Telegram用户名"`
  9. UserId int64 `json:"userId" gorm:"type:bigint;default:0;comment:使用该令牌绑定的平台用户ID"`
  10. Status int `json:"status" gorm:"type:tinyint;default:0;comment:状态: 0=未使用, 1=已使用, 2=已过期"`
  11. ExpireAt time.Time `json:"expireAt" gorm:"type:timestamp;comment:过期时间;NOT NULL"`
  12. }
  13. func (*TgBindToken) TableName() string {
  14. return ModelPrefix + "tg_bind_token"
  15. }
  16. func (*TgBindToken) Comment() string {
  17. return "Telegram绑定令牌表"
  18. }
  19. func NewTgBindToken() *TgBindToken {
  20. return &TgBindToken{}
  21. }