go_dreamfactory/modules/horoscope/configure.go
2022-10-31 18:56:13 +08:00

45 lines
1.0 KiB
Go

package horoscope
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_horoscope = "game_horoscope.json" //购买挑战记录
)
///竞技场配置管理组件
type configureComp struct {
modules.MCompConfigure
module *Horoscope
}
//组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Horoscope)
this.LoadConfigure(game_horoscope, cfg.NewGameHoroscope)
return
}
//查询阵容表
func (this *configureComp) getHoroscope(id int32) (result *cfg.GameHoroscopeData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_horoscope); err != nil {
this.module.Errorln(err)
} else {
if result, ok = v.(*cfg.GameHoroscope).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found getHoroscope:%d", id)
this.module.Errorln(err)
}
}
return
}