From 87fb35d43cd88865499547e5e5aa6505a642efc5 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 18 Aug 2022 16:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E5=AD=A3=E5=A1=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 2 ++ modules/pagoda/api_challenge.go | 2 +- modules/pagoda/model_rank.go | 48 +++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 modules/pagoda/model_rank.go diff --git a/comm/const.go b/comm/const.go index 737f4c4fb..1f793be15 100644 --- a/comm/const.go +++ b/comm/const.go @@ -103,6 +103,8 @@ const ( TableGourmet = "gourmet" // 随机任务 TableRtask = "rtask" + ///爬塔排行 + TablePagodaRank = "pagodarank" ) //RPC服务接口定义处 diff --git a/modules/pagoda/api_challenge.go b/modules/pagoda/api_challenge.go index 00bf7c239..f0ac2ea03 100644 --- a/modules/pagoda/api_challenge.go +++ b/modules/pagoda/api_challenge.go @@ -28,7 +28,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng code = pb.ErrorCode_PagodaNotFound return } - cfg := this.module.configure.GetPagodaconfig(req.LevelID) + cfg := this.module.configure.GetPagodaConfigData(req.PagodaType, req.LevelID) if cfg == nil { code = pb.ErrorCode_PagodaNotFound return diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go new file mode 100644 index 000000000..c40130d1d --- /dev/null +++ b/modules/pagoda/model_rank.go @@ -0,0 +1,48 @@ +package pagoda + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + "go_dreamfactory/pb" +) + +type ModelRank struct { + modules.MCompModel + moduleUser *Pagoda +} + +func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.TableName = comm.TablePagodaRank + err = this.MCompModel.Init(service, module, comp, options) + this.moduleUser = module.(*Pagoda) + return +} + +//获取用户 +func (this *ModelRank) getUserSession(uid string) (cuser *pb.CacheUser) { + cuser = &pb.CacheUser{} + if err := this.Get(uid, cuser); err != nil { + this.moduleUser.Errorf("GetUserSession err:%v", err) + return + } + return +} + +//获取用户通过扩展表 +// func (this *ModelRank) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { +// result = &pb.DBUserExpand{} +// if err = this.moduleUser.modelExpand.Get(uid, result); err != nil && redis.RedisNil != err { +// return +// } +// err = nil +// return result, err +// } + +// func (this *ModelRank) ChangeUserExpand(uid string, value map[string]interface{}) (err error) { +// if len(value) == 0 { +// return nil +// } +// return this.moduleUser.modelExpand.Change(uid, value) + +// }