互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
2.0 KiB

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const DanMuServerTableName = TableNamePrefix + "dan_mu_server"
  7. type DanMuServer struct {
  8. Id int64 `json:"id" xorm:"not null pk autoincr"`
  9. ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)" description:"主活动id"`
  10. DanmuSwitch string `json:"danmu_switch" xorm:"not null default('关闭') comment('弹幕服务开启、关闭') VARCHAR(255)"`
  11. DanmuOpacity int `json:"danmu_opacity" xorm:"not null default(100) comment('弹幕透明度') INT(11)"`
  12. DanmuSpeed int `json:"danmu_speed" xorm:"not null default(50) comment('弹幕速度') INT(11)"`
  13. DanmuPosition string `json:"danmu_position" xorm:"not null default('顶部') comment('弹幕位置[顶部 底部 满屏]')"`
  14. DanmuFontSize string `json:"danmu_font_size" xorm:"not null default('中') comment('字号大小[大 中 小]')"`
  15. ServerDisplay string `json:"server_display" xorm:"not null default('消息界面') comment('霸屏展示方式 [消息界面|互动界面]') VARCHAR(255)"`
  16. ServerStartTime time.Time `json:"server_start_time" xorm:"not null default('1970-01-01 08:00:00') comment('开启时间') DATETIME"`
  17. ServerEndTime time.Time `json:"server_end_time" xorm:"not null default('1970-01-01 08:00:00') comment('结束时间') DATETIME" description:"关闭时间"`
  18. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
  19. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME" description:"创建时间"`
  20. UpdatedAt time.Time `json:"updated_at" xorm:"not null default(CURRENT_TIMESTAMP) updated comment('更新时间') TIMESTAMP" description:"更新时间"`
  21. }
  22. func (t *DanMuServer) TableName() string {
  23. return DanMuServerTableName
  24. }
  25. func (t *DanMuServer) GetByActivityId(aid int64) (bool, error) {
  26. return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t)
  27. }