互动
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.

31 lines
1.5 KiB

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const BaheTeamTable = TableNamePrefix + "bahe_team"
  7. //拔河队伍
  8. type BaheTeam struct {
  9. Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
  10. ActivityId int64 `json:"activity_id" xorm:"not null comment('活动id') INT(11)"`
  11. BaheActivityId int64 `json:"bahe_activity_id" xorm:"not null comment('拔河活动id') INT(11) "`
  12. BaheTeamName string `json:"bahe_team_name" xorm:"not null comment('拔河队伍得名称') VARCHAR(255)"`
  13. TotalScore int64 `json:"total_score" xorm:"-" description:"总分数"`
  14. Rank int `json:"rank" xorm:"-" description:"排名"`
  15. Members []*BaheTeamMember `json:"members" xorm:"-" description:"队伍人数"`
  16. Qrcode string `json:"qrcode" xorm:"-" description:"二维码"`
  17. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否已删除') TINYINT(1)"`
  18. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
  19. UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
  20. }
  21. func (t *BaheTeam) TableName() string {
  22. return BaheTeamTable
  23. }
  24. func (t *BaheTeam) GetOtherTeam(id, bid int64) (bool, error) {
  25. return core.GetXormAuto().Where("is_delete=0 and id=? and bahe_activity_id=?", id, bid).Get(t)
  26. }