52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
package addrecharge
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
const (
|
|
game_accumulate = "game_accumulate.json"
|
|
)
|
|
|
|
type configureComp struct {
|
|
modules.MCompConfigure
|
|
module *AddRecharge
|
|
}
|
|
|
|
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)
|
|
this.module = module.(*AddRecharge)
|
|
this.LoadConfigure(game_accumulate, cfg.NewGameAccumulate)
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getGameAccumulate(id int32) (conf *cfg.GameAccumulateData, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(game_accumulate); err != nil {
|
|
return
|
|
}
|
|
if conf, ok = v.(*cfg.GameAccumulate).GetDataMap()[id]; !ok {
|
|
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_accumulate, id)
|
|
this.module.Errorln(err)
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getGameAccumulates() (confs []*cfg.GameAccumulateData, err error) {
|
|
var (
|
|
v interface{}
|
|
)
|
|
if v, err = this.GetConfigure(game_accumulate); err != nil {
|
|
return
|
|
}
|
|
confs = v.(*cfg.GameAccumulate).GetDataList()
|
|
return
|
|
}
|