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

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const LotteryDrawActivityTableName = TableNamePrefix + "lottery_draw_activity"
  7. //抽奖活动
  8. type LotteryDrawActivity struct {
  9. Id int64 `json:"id"`
  10. ActivityId int64 `json:"activity_id" description:"主活动的id"`
  11. CreatorId int64 `json:"creator_id" description:"创建者id"`
  12. LotteryDrawActivityName string `json:"lottery_draw_activity_name" description:"抽奖轮次名称"`
  13. LotteryDrawRule *LotteryDrawRule `json:"lottery_draw_rule" xorm:"-" description:"抽奖活动规则"`
  14. IsDelete bool `json:"-" xorm:"default(0)"`
  15. CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
  16. UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
  17. }
  18. func (t *LotteryDrawActivity) TableName() string {
  19. return LotteryDrawActivityTableName
  20. }
  21. func GetLDActivityIdsByActivityId(aid int64) ([]int64, error) {
  22. lotteryIds := make([]int64, 0)
  23. err := core.GetXormAuto().Table(new(LotteryDrawActivity)).Select("id").
  24. Where("is_delete=0 and activity_id=?", aid).Find(&lotteryIds)
  25. return lotteryIds, err
  26. }