52 lines
1.0 KiB
Go
52 lines
1.0 KiB
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
const (
|
|
game_serverlist = "game_serverlist.json"
|
|
)
|
|
|
|
type configureComp struct {
|
|
modules.MCompConfigure
|
|
}
|
|
|
|
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
|
err = this.LoadConfigure(game_serverlist, cfg.NewGame_serverList)
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getConfig() (data *cfg.Game_serverList, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(game_serverlist); err != nil {
|
|
return
|
|
} else {
|
|
if data, ok = v.(*cfg.Game_serverList); !ok {
|
|
err = fmt.Errorf("%T no is *cfg.Game_ActiveReward", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getServerListConf() (data []*cfg.Game_serverListData) {
|
|
conf, err := this.getConfig()
|
|
if err != nil {
|
|
return data
|
|
}
|
|
|
|
if conf != nil {
|
|
return conf.GetDataList()
|
|
}
|
|
|
|
return
|
|
}
|