data.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package battlepass
  2. import (
  3. item "bet24.com/servers/micros/item_inventory/proto"
  4. "time"
  5. )
  6. const (
  7. GrowthTermStatus_none = iota // 没有
  8. GrowthTermStatus_complete // 可领取
  9. GrowthTermStatus_awarded // 已领取
  10. )
  11. type BattlePassSeason struct {
  12. StartDate int
  13. EndDate int
  14. MaxDayExp int
  15. MaxExp int
  16. SeasonId int
  17. Packs []GrowthPack
  18. }
  19. func (bs *BattlePassSeason) isValid() bool {
  20. dayIndex := getDayIndex()
  21. return dayIndex >= bs.StartDate && dayIndex <= bs.EndDate
  22. }
  23. type GrowthPack struct {
  24. Id int // 礼包ID
  25. Name string // 名称
  26. ProductId string // 商城产品ID
  27. Price int // 价格
  28. FullProductId string
  29. FullPrice int // 完整购买价格
  30. Terms []GrowthTerm // 礼包列表
  31. }
  32. type GrowthTerm struct {
  33. TermIndex int // index
  34. Name string // 名称
  35. NeedExp int // 所需经验
  36. Items []item.ItemPack // 礼包内容
  37. }
  38. type UserGrowthTerm struct {
  39. UserId int // 用户ID,客户端不发
  40. GrowthPackId int // 礼包ID
  41. TermIndex int // index
  42. NeedExp int // 当前经验值
  43. Status int // 目前状态
  44. }
  45. func getDayIndex() int {
  46. now := time.Now()
  47. return now.Year() + int(now.Month()) + now.Day()
  48. }