package pushgiftbag import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( game_pushgift = "game_pushgift.json" ) type configureComp struct { modules.MCompConfigure module *PushGiftbag } 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.(*PushGiftbag) this.LoadConfigure(game_pushgift, cfg.NewGamePushGift) return } //获取礼包代码 func (this *configureComp) getGamePushGift() (conf []*cfg.GamePushGiftData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_pushgift); err != nil { return } conf = v.(*cfg.GamePushGift).GetDataList() return } //获取礼包代码 func (this *configureComp) getGamePushGiftbyid(id int32) (conf *cfg.GamePushGiftData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_pushgift); err != nil { return } if conf, ok = v.(*cfg.GamePushGift).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pushgift, id) this.module.Errorln(err) return } return }