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

38 lines
1.6 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "time"
  4. "github.com/ouxuanserver/osmanthuswine/src/core"
  5. )
  6. const InvitationLetterTableName = TableNamePrefix + "invitation_letter"
  7. type InvitationLetter struct {
  8. Id int64 `json:"id" xorm:"pk autoincr" description:"主键"`
  9. UserId int64 `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
  10. ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
  11. InvitationId int64 `json:"invitation_id" xorm:"not null default(0) comment('邀请函id') INT(11)"`
  12. RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
  13. ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"`
  14. IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"`
  15. CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建"`
  16. UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新"`
  17. }
  18. func (t *InvitationLetter) TableName() string {
  19. return InvitationLetterTableName
  20. }
  21. func (t *InvitationLetter) Alias(name string) string {
  22. return AliasTableName(t, name)
  23. }
  24. func (t *InvitationLetter) GetByUserIdAndActivityId(uid, aid, rid int64) (bool, error) {
  25. return core.GetXormAuto().Where("user_id=? and activity_id=? and rehearsal_id=? and is_delete=0", uid, aid, rid).Get(t)
  26. }
  27. func (t *InvitationLetter) Count(activityId, rehearsalId interface{}) (int64, error) {
  28. return core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=?", activityId, rehearsalId).
  29. Count(t)
  30. }