go_dreamfactory/modules/pay/configure.go
2022-11-04 11:35:21 +08:00

46 lines
1.0 KiB
Go

package pay
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_recharge = "game_recharge.json"
)
///背包配置管理组件
type configureComp struct {
modules.MCompConfigure
module *Pay
}
//组件初始化接口
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.(*Pay)
this.LoadConfigure(game_recharge, cfg.NewGameRecharge)
return
}
//获取手动加入频道 任务限制
func (this *configureComp) getGameRecharge(id string) (result *cfg.GameRechargeData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_recharge); err != nil {
this.module.Errorf("err:%v", err)
return
} else {
if result, ok = v.(*cfg.GameRecharge).GetDataMap()[id]; !ok {
err = fmt.Errorf("getGameRecharge on found %d", id)
this.module.Errorf("err:%v", err)
return
}
}
return
}