From 2107b54b652275a54cdacd1e3be5522fbc6c78b8 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 2 Aug 2023 18:54:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E9=98=9F=E7=BB=93=E7=AE=97=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E8=B6=85=E5=87=BA=E9=83=A8=E5=88=86=E8=BD=AC=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E9=81=93=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/caravan/comp_configure.go | 27 +++++++++++++++++++-------- modules/caravan/module.go | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/modules/caravan/comp_configure.go b/modules/caravan/comp_configure.go index d48b721d9..8b801e6f8 100644 --- a/modules/caravan/comp_configure.go +++ b/modules/caravan/comp_configure.go @@ -24,9 +24,10 @@ const ( ///配置管理基础组件 type configureComp struct { modules.MCompConfigure - module *Caravan - lock sync.RWMutex - event map[int32][]*cfg.GameCaravanEventData + module *Caravan + lock sync.RWMutex + event map[int32][]*cfg.GameCaravanEventData + overflow int32 } //组件初始化接口 @@ -52,7 +53,19 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp } this.lock.Unlock() }) - + configure.RegisterConfigure(game_caravan_reward, cfg.NewGameCaravanReward, func() { + if v, err := this.GetConfigure(game_caravan_event); err != nil { + this.module.Errorf("err:%v", err) + return + } else { + for _, v := range v.(*cfg.GameCaravanReward).GetDataList() { + if v.Key < 0 { + this.overflow = v.Id + return + } + } + } + }) return } @@ -209,12 +222,10 @@ func (this *configureComp) GetCaravanReward() (reward []*cfg.GameCaravanRewardDa return } -func (this *configureComp) GetCaravanMoreReward() (reward []*cfg.Gameatn) { +func (this *configureComp) GetCaravanMoreReward() (reward *cfg.GameCaravanRewardData) { if v, err := this.GetConfigure(game_caravan_reward); err == nil { if configure, ok := v.(*cfg.GameCaravanReward); ok { - if configure.Get(0) != nil { - return configure.Get(0).Reward - } + reward = configure.Get(this.overflow) } } else { log.Errorf("get GetCaravanInitCity conf err:%v", err) diff --git a/modules/caravan/module.go b/modules/caravan/module.go index 4f069d83b..f0e64f697 100644 --- a/modules/caravan/module.go +++ b/modules/caravan/module.go @@ -465,7 +465,7 @@ func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.E if maxKey <= temp.Merchantmoney { var res []*cfg.Gameatn - for _, v := range moreReard { + for _, v := range moreReard.Reward { if v.N == 0 { continue }