package achieve import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" "sync" ) const ( game_achievetask = "game_achievetask.json" ) type configureComp struct { modules.MCompConfigure module *Achieve tasksConf []int32 lock sync.RWMutex } 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.(*Achieve) this.LoadConfigure(game_achievetask, cfg.NewGameAchieveTask) return } //查询积分段位信息 func (this *configureComp) getAchieveTaskById(id int32) (result *cfg.GameAchieveTaskData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_achievetask); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameAchieveTask).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_achievetask, id) this.module.Errorln(err) } } return } //查询积分段位信息 func (this *configureComp) getAchieveTaskAll() (confs []*cfg.GameAchieveTaskData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_achievetask); err != nil { this.module.Errorln(err) } else { confs = v.(*cfg.GameAchieveTask).GetDataList() } return }