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

43 lines
2.1 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const VoteActivityHistoryTableName = TableNamePrefix + "new_vote_activity_history"
  7. type NewVoteActivityHistory struct {
  8. Id int64 `json:"id" xorm:"pk autoincr INT(11)"`
  9. VoteActivityId int64 `json:"vote_activity_id" xorm:"not null default(0) comment('投票活动id') INT(11)"`
  10. VoteActivityLadderId int64 `json:"vote_activity_ladder_id" xorm:"not null default(0) comment('投票活动对象') INT(11)"`
  11. RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') INT(11)"`
  12. UserId int64 `json:"user_id" xorm:"not null default(0) comment('投票人') INT(11)"`
  13. ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
  14. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"`
  15. CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间')"`
  16. UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新时间')"`
  17. }
  18. func (t *NewVoteActivityHistory) TableName() string {
  19. return VoteActivityHistoryTableName
  20. }
  21. func (t *NewVoteActivityHistory) Alias(name string) string {
  22. return Alias(t, name)
  23. }
  24. func (t *NewVoteActivityHistory) ExistByLadderId(uid, lid, rid int64, archId interface{}) (bool, error) {
  25. return core.GetXormAuto().Where("is_delete=0 and user_id=? and vote_activity_ladder_id=? and "+
  26. " rehearsal_id=? and arch_id=?", uid, lid, rid, archId).Exist(t)
  27. }
  28. func (t *NewVoteActivityHistory) ExistByVoteId(uid, vid, rid int64, archId interface{}) (bool, error) {
  29. return core.GetXormAuto().Where("is_delete=0 and user_id=? and vote_activity_id=? and "+
  30. " rehearsal_id=? and arch_id=?", uid, vid, rid, archId).Exist(t)
  31. }
  32. func (t *NewVoteActivityHistory) CountUser(uid, rid, vid int64, archId interface{}) (int64, error) {
  33. return core.GetXormAuto().Where("is_delete=0 and user_id=? and rehearsal_id=? and "+
  34. " vote_activity_id=? and arch_id=?", uid, rid, vid, archId).Count(t)
  35. }