add stats daily

This commit is contained in:
shoopea
2021-12-10 21:22:10 +08:00
parent 7590355d87
commit 15203263e6
5 changed files with 60 additions and 49 deletions

View File

@@ -44,18 +44,20 @@ type ClientConfig struct {
}
type Config struct {
Server *ServerConfig `json:"server"`
Telegram *TelegramConfig `json:"telegram"`
Game *GameConfig `json:"game"`
Clients map[int]*ClientConfig `json:"clients"`
Stats map[int]map[string]*Stat `json:"stats"`
Server *ServerConfig `json:"server"`
Telegram *TelegramConfig `json:"telegram"`
Game *GameConfig `json:"game"`
Clients map[int]*ClientConfig `json:"clients"`
StatsMonthly map[int]map[string]*StatMonthly `json:"stats_monthly"`
StatsDaily map[int]map[string]*StatDaily `json:"stats_daily"`
}
// Init values for a config based on package defaults
func (c *Config) Init() error {
err := json.Unmarshal(cfgSample, &c)
c.Clients = make(map[int]*ClientConfig)
c.Stats = make(map[int]map[string]*Stat)
c.StatsMonthly = make(map[int]map[string]*StatMonthly)
c.StatsDaily = make(map[int]map[string]*StatDaily)
if err != nil {
return err