league_storage.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. var LeagueStorage = &leagueStorageConfig{}
  4. func init() {
  5. _allList = append(_allList, LeagueStorage)
  6. }
  7. type (
  8. LeagueStorageRow struct {
  9. ID int32 `json:"ID"` // 资源ID
  10. InitRate int32 `json:"InitRate"` // 初始默认税率(百分比)
  11. MinRate int32 `json:"MinRate"` // 税率下限(百分比)
  12. MaxRate int32 `json:"MaxRate"` // 税率上限(百分比)
  13. AdjustTimes int32 `json:"AdjustTimes"` // 税率调整次数(每日)
  14. FBonusTimes int32 `json:"fBonusTimes"` // F币分红次数(每日)
  15. MinFBonus int64 `json:"MinFBonus"` // F币分红最小值
  16. }
  17. leagueStorageConfig struct {
  18. baseConfig
  19. list []*LeagueStorageRow // all list
  20. idUniMaps map[int32]*LeagueStorageRow // key:id
  21. }
  22. )
  23. func (p *leagueStorageConfig) Name() string {
  24. return "league_storage"
  25. }
  26. func (p *leagueStorageConfig) Init() {
  27. p.idUniMaps = map[int32]*LeagueStorageRow{}
  28. }
  29. func (p *leagueStorageConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  30. if reload && p.denyLoad {
  31. return 0, nil
  32. }
  33. var list []*LeagueStorageRow
  34. if err := DecodeData(maps, &list); err != nil {
  35. return 0, err
  36. }
  37. p.list = list
  38. idUniMaps := map[int32]*LeagueStorageRow{}
  39. for _, row := range list {
  40. idUniMaps[row.ID] = row
  41. }
  42. p.idUniMaps = idUniMaps
  43. return len(list), nil
  44. }
  45. // func (p *leagueStorageConfig) OnAfterLoad(_ bool) {
  46. // }
  47. func (p *leagueStorageConfig) List() []*LeagueStorageRow {
  48. return p.list
  49. }
  50. func (p *leagueStorageConfig) GetByID(id int32) (*LeagueStorageRow, bool) {
  51. value, found := p.idUniMaps[id]
  52. return value, found
  53. }
  54. func (p *leagueStorageConfig) ContainID(id int32) bool {
  55. _, found := p.idUniMaps[id]
  56. return found
  57. }