From 830997df434fe5d5d1769768c53efaa0caff2969 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 13 Oct 2022 12:02:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=8B=A9=E7=8C=8E=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 2 +- comm/imodule.go | 5 ++++- lego/utils/codec/factory/factory_struct.go | 2 ++ modules/hunting/model_rank.go | 9 +++++---- modules/hunting/module.go | 13 +++++++++++++ modules/timer/huntingrank.go | 2 +- 6 files changed, 26 insertions(+), 7 deletions(-) diff --git a/comm/const.go b/comm/const.go index 8c3dd88a3..d4aedaa91 100644 --- a/comm/const.go +++ b/comm/const.go @@ -136,7 +136,7 @@ const ( // TableHunting = "hunting" // 维京远征排行榜 - TableHuntingRank = "huntingrank" + TableHuntingRecord = "huntingrecord" TableHuntingRankList = "huntingrankList" // 支线剧情任务 TableLinestory = "linestory" diff --git a/comm/imodule.go b/comm/imodule.go index e5eb9c56b..3056abf4f 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -183,6 +183,9 @@ type ( Trigger(session IUserSession, source *pb.BattleReport) } IViking interface { - CheckUserBaseVikingInfo(uid string) (data *pb.DBViking) // 查询玩家最佳通关记录 + CheckUserBaseVikingInfo(uid string) (data []*pb.DBViking) // 查询玩家最佳通关记录 + } + IHunting interface { + CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录 } ) diff --git a/lego/utils/codec/factory/factory_struct.go b/lego/utils/codec/factory/factory_struct.go index a475652e3..37633921a 100644 --- a/lego/utils/codec/factory/factory_struct.go +++ b/lego/utils/codec/factory/factory_struct.go @@ -10,6 +10,7 @@ import ( "unicode" "unsafe" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/utils/codec/codecore" "github.com/modern-go/reflect2" @@ -108,6 +109,7 @@ func describeStruct(ctx *codecore.Ctx, typ reflect2.Type) *StructDescriptor { bindings := []*Binding{} for i := 0; i < structType.NumField(); i++ { field := structType.Field(i) + log.Debugf("field:%v", field) tag, hastag := field.Tag().Lookup(ctx.Config.TagKey) if ctx.Config.OnlyTaggedField && !hastag && !field.Anonymous() { continue diff --git a/modules/hunting/model_rank.go b/modules/hunting/model_rank.go index 7ef137a42..62c9e962d 100644 --- a/modules/hunting/model_rank.go +++ b/modules/hunting/model_rank.go @@ -15,14 +15,15 @@ type ModelRank struct { } func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.TableName = comm.TableHuntingRank + this.TableName = comm.TableHuntingRecord // 挑战记录 err = this.MCompModel.Init(service, module, comp, options) this.moduleHunting = module.(*Hunting) return } -func (this *ModelRank) AddRank(uId string, data *pb.DBHuntingRank) (err error) { - if err = this.Add(uId, data); err != nil { +func (this *ModelRank) AddRankList(uId string, objId string, data *pb.DBHuntingRank) (err error) { + + if err = this.AddList(uId, objId, data); err != nil { return } return nil @@ -91,7 +92,7 @@ func (this *ModelRank) updatehuntingRankList(session comm.IUserSession, difficul Line: line, CostTime: costTime, } - this.AddList(session.GetUserId(), new.Id, new) + this.AddRankList(session.GetUserId(), new.Id, new) } return } diff --git a/modules/hunting/module.go b/modules/hunting/module.go index 2c7a00a0c..86d353374 100644 --- a/modules/hunting/module.go +++ b/modules/hunting/module.go @@ -58,3 +58,16 @@ func (this *Hunting) ModifyHuntingData(uid string, data map[string]interface{}) } return } + +func (this *Hunting) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) { + list, err := this.modelHunting.getHuntingList(uid) + if err != nil { + for k := range list.Boss { + _d := this.modulerank.getHuntingRankListByBossType(uid, k) + if _d != nil { + data = append(data, _d) + } + } + } + return +} diff --git a/modules/timer/huntingrank.go b/modules/timer/huntingrank.go index 2e62350d2..9933dcfb6 100644 --- a/modules/timer/huntingrank.go +++ b/modules/timer/huntingrank.go @@ -22,7 +22,7 @@ type HuntingRank struct { //组件初始化接口 func (this *HuntingRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.DbName = comm.TableHuntingRank + this.DbName = comm.TableHuntingRecord this.TableName = comm.TableHuntingRankList this.MCompModel.Init(service, module, comp, options) this.service = service