From 59449e24cc29cfdb56a0f1cad4411362256bdff6 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 21 Nov 2022 10:34:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BA=A2=E7=82=B9=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 27 ++++++++++++++++++--------- modules/horoscope/module.go | 12 ++++++++++++ modules/mainline/module.go | 4 ++-- modules/pagoda/module.go | 2 +- modules/reddot/api_get.go | 8 ++++---- modules/reddot/api_getall.go | 6 +++--- modules/sociaty/module.go | 6 +++--- modules/task/module.go | 8 ++++---- 8 files changed, 47 insertions(+), 26 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 0d8e40e97..d53e21c51 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -4,6 +4,12 @@ import ( "go_dreamfactory/pb" ) +type ( + IReddot interface { + Reddot(session IUserSession, rid ...ReddotType) map[ReddotType]bool + } +) + /* 业务模块 对外接口定义处 */ @@ -125,8 +131,8 @@ type ( ModifyMainlineData(uid string, id int32) (code pb.ErrorCode) /// 查询章节ID GetUsermainLineData(uid string) (mainlineId int32) - - Reddot(uid string, rid ...ReddotType) map[ReddotType]bool + ///红点 + IReddot } //任务 ITask interface { @@ -142,8 +148,8 @@ type ( GetTaskById(uid string, taskId int32) *pb.DBTask // 获取已完成的任务列表 GetTaskFinished(uid string, taskType TaskTag) []*pb.DBTask - // 红点 - Reddot(uid string, rid ...ReddotType) map[ReddotType]bool + ///红点 + IReddot } // 随机任务 @@ -208,8 +214,8 @@ type ( IPagoda interface { ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode) CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录 - - Reddot(uid string, rid ...ReddotType) map[ReddotType]bool + ///红点 + IReddot } IHeroFetter interface { @@ -237,13 +243,15 @@ type ( MembersByUid(uid string) (list []*pb.SociatyMemberInfo) // 获取公会成员 MembersBySociatyId(sociatyId string) (list []*pb.SociatyMemberInfo) - //红点 - Reddot(uid string, rid ...ReddotType) map[ReddotType]bool + ///红点 + IReddot } //星座图 IHoroscope interface { //计算新作图属性 ComputeHeroNumeric(uid string, hero ...*pb.DBHero) + ///红点 + IReddot } IPrivilege interface { // 创建一个新的特权卡 @@ -257,7 +265,8 @@ type ( } //武馆 IMartialhall interface { - Reddot(uid string, rid ...ReddotType) map[ReddotType]bool + ///红点 + IReddot } // 世界任务 IWorldtask interface { diff --git a/modules/horoscope/module.go b/modules/horoscope/module.go index 65e4d6a00..deccbd596 100644 --- a/modules/horoscope/module.go +++ b/modules/horoscope/module.go @@ -57,3 +57,15 @@ func (this *Horoscope) ComputeHeroNumeric(uid string, hero ...*pb.DBHero) { this.modelHoroscope.computeHeroNumeric(uid, hero...) return } + +//红点需求 +func (this *Horoscope) Reddot(uid string, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) { + result = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot17: + break + } + } + return +} diff --git a/modules/mainline/module.go b/modules/mainline/module.go index d0061dbc8..55564698a 100644 --- a/modules/mainline/module.go +++ b/modules/mainline/module.go @@ -100,11 +100,11 @@ func (this *Mainline) Start() (err error) { } //红点查询 -func (this *Mainline) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *Mainline) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) for _, v := range rid { if v == comm.Reddot5 { - reddot[comm.Reddot5] = this.CheckPoint(uid) + reddot[comm.Reddot5] = this.CheckPoint(session.GetUserId()) break } } diff --git a/modules/pagoda/module.go b/modules/pagoda/module.go index e268eec04..2c1b0c2bd 100644 --- a/modules/pagoda/module.go +++ b/modules/pagoda/module.go @@ -150,7 +150,7 @@ func (this *Pagoda) SetPagodaRankList(tableName string, score int32, uid string) } //红点查询 -func (this *Pagoda) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *Pagoda) Reddot(session comm.UserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) return diff --git a/modules/reddot/api_get.go b/modules/reddot/api_get.go index 120989827..dca87e97c 100644 --- a/modules/reddot/api_get.go +++ b/modules/reddot/api_get.go @@ -25,19 +25,19 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code // reddot[v] = false switch rid { case int32(comm.Reddot1): - for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot1) { + for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1) { reddot[int32(k)] = v } case int32(comm.Reddot2): - for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot2) { + for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { reddot[int32(k)] = v } case int32(comm.Reddot3): - for k, v := range this.module.ModuleSociaty.Reddot(session.GetUserId(), comm.Reddot3) { + for k, v := range this.module.ModuleSociaty.Reddot(session, comm.Reddot3) { reddot[int32(k)] = v } case int32(comm.Reddot4): - for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot2) { + for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { reddot[int32(k)] = v } } diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index 010bdb508..28b81215a 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -21,13 +21,13 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success { return } - for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot1, comm.Reddot2, comm.Reddot3, comm.Reddot4) { + for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1, comm.Reddot2, comm.Reddot3, comm.Reddot4) { reddot[int32(k)] = v } - for k, v := range this.module.mainline.Reddot(session.GetUserId(), comm.Reddot5) { + for k, v := range this.module.mainline.Reddot(session, comm.Reddot5) { reddot[int32(k)] = v } - for k, v := range this.module.pagoda.Reddot(session.GetUserId(), comm.Reddot6) { + for k, v := range this.module.pagoda.Reddot(session, comm.Reddot6) { reddot[int32(k)] = v } session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot}) diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index c8883588c..0051358b6 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -119,9 +119,9 @@ func (this *Sociaty) MembersBySociatyId(sociatyId string) (list []*pb.SociatyMem } //公会 -func (this *Sociaty) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) - sociaty := this.modelSociaty.getUserSociaty(uid) + sociaty := this.modelSociaty.getUserSociaty(session.GetUserId()) if sociaty == nil || sociaty.Id == "" { reddot[comm.Reddot3] = false return @@ -129,7 +129,7 @@ func (this *Sociaty) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm for _, v := range rid { switch v { case comm.Reddot3: - if ok := this.modelSociaty.IsSign(uid, sociaty); !ok { + if ok := this.modelSociaty.IsSign(session.GetUserId(), sociaty); !ok { reddot[comm.Reddot3] = true } } diff --git a/modules/task/module.go b/modules/task/module.go index 43360c195..b77c2fd57 100644 --- a/modules/task/module.go +++ b/modules/task/module.go @@ -143,23 +143,23 @@ func (this *ModuleTask) GetTaskFinished(uid string, taskTage comm.TaskTag) []*pb return this.modelTask.getFinishTasks(uid, taskTage) } -func (this *ModuleTask) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { +func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) { reddot = make(map[comm.ReddotType]bool) for _, v := range rid { switch v { case comm.Reddot1: - if ok, _ := this.modelTask.noReceiveTask(uid, comm.TASK_DAILY); ok { + if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_DAILY); ok { reddot[comm.Reddot1] = ok break } case comm.Reddot2: - if ok, _ := this.modelTask.noReceiveTask(uid, comm.TASK_WEEKLY); ok { + if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_WEEKLY); ok { reddot[comm.Reddot2] = ok break } case comm.Reddot4: - if ok, _ := this.modelTask.noReceiveTask(uid, comm.TASK_ACHIEVE); ok { + if ok, _ := this.modelTask.noReceiveTask(session.GetUserId(), comm.TASK_ACHIEVE); ok { reddot[comm.Reddot4] = ok break }