vip_daily_exp.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. var VipDailyExp = &vipDailyExpConfig{}
  4. func init() {
  5. _allList = append(_allList, VipDailyExp)
  6. }
  7. type (
  8. VipDailyExpRow struct {
  9. Day int32 `json:"Day"` // 天数
  10. Exp int64 `json:"Exp"` // 点数
  11. }
  12. vipDailyExpConfig struct {
  13. baseConfig
  14. list []*VipDailyExpRow // all list
  15. dayUniMaps map[int32]*VipDailyExpRow // key:day
  16. }
  17. )
  18. func (p *vipDailyExpConfig) Name() string {
  19. return "vip_daily_exp"
  20. }
  21. func (p *vipDailyExpConfig) Init() {
  22. p.dayUniMaps = map[int32]*VipDailyExpRow{}
  23. }
  24. func (p *vipDailyExpConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  25. if reload && p.denyLoad {
  26. return 0, nil
  27. }
  28. var list []*VipDailyExpRow
  29. if err := DecodeData(maps, &list); err != nil {
  30. return 0, err
  31. }
  32. p.list = list
  33. dayUniMaps := map[int32]*VipDailyExpRow{}
  34. for _, row := range list {
  35. dayUniMaps[row.Day] = row
  36. }
  37. p.dayUniMaps = dayUniMaps
  38. return len(list), nil
  39. }
  40. // func (p *vipDailyExpConfig) OnAfterLoad(_ bool) {
  41. // }
  42. func (p *vipDailyExpConfig) List() []*VipDailyExpRow {
  43. return p.list
  44. }
  45. func (p *vipDailyExpConfig) GetByDay(day int32) (*VipDailyExpRow, bool) {
  46. value, found := p.dayUniMaps[day]
  47. return value, found
  48. }
  49. func (p *vipDailyExpConfig) ContainDay(day int32) bool {
  50. _, found := p.dayUniMaps[day]
  51. return found
  52. }