diff --git a/comm/imodule.go b/comm/imodule.go index 8bed59e1e..6df78fa5c 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -282,4 +282,9 @@ type ( // 任务完成通知 TaskFinishNotify(uid string, taskId, groupId int32) error } + //竞技场 + IArena interface { + ///红点 + IReddot + } ) diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index d1ac98be8..a1ac5c384 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -383,3 +383,17 @@ func (this *modelArena) recoverTicket(info *pb.DBArenaUser) { } } } + +func (this *modelArena) reddot(session comm.IUserSession) bool { + var ( + info *pb.DBArenaUser + err error + ) + if info, err = this.queryPlayerInfo(session.GetUserId()); err != nil { + return false + } + if info.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos { + return true + } + return false +} diff --git a/modules/arena/module.go b/modules/arena/module.go index 989912a66..da92f88e4 100644 --- a/modules/arena/module.go +++ b/modules/arena/module.go @@ -68,6 +68,21 @@ func (this *Arena) OnInstallComp() { //比赛结算 func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) { - this.Debug("Rpc_ModuleArenaRaceSettlement", log.Fields{ "args": args.String()}) + this.Debug("Rpc_ModuleArenaRaceSettlement", log.Fields{"args": args.String()}) this.modelRank.raceSettlement() } + +//红点需求 +func (this *Arena) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]bool) { + result = make(map[comm.ReddotType]bool) + for _, v := range rid { + switch v { + case comm.Reddot19: + if isredot := this.modelArena.reddot(session); isredot { + result[comm.Reddot19] = true + } + break + } + } + return +} diff --git a/modules/reddot/api_get.go b/modules/reddot/api_get.go index 9c80b4807..608cd7959 100644 --- a/modules/reddot/api_get.go +++ b/modules/reddot/api_get.go @@ -23,29 +23,34 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code } for _, rid := range req.Rids { // reddot[v] = false - switch rid { - case int32(comm.Reddot1): - for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1) { + _rid := comm.ReddotType(rid) + switch _rid { + case comm.Reddot1: + for k, v := range this.module.ModuleTask.Reddot(session, _rid) { reddot[int32(k)] = v } - case int32(comm.Reddot2): - for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { + case comm.Reddot2: + for k, v := range this.module.ModuleTask.Reddot(session, _rid) { reddot[int32(k)] = v } - case int32(comm.Reddot3): - for k, v := range this.module.ModuleSociaty.Reddot(session, comm.Reddot3) { + case (comm.Reddot3): + for k, v := range this.module.ModuleSociaty.Reddot(session, _rid) { reddot[int32(k)] = v } - case int32(comm.Reddot4): - for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { + case (comm.Reddot4): + for k, v := range this.module.ModuleTask.Reddot(session, _rid) { reddot[int32(k)] = v } - case int32(comm.Reddot17): - for k, v := range this.module.horoscope.Reddot(session, comm.Reddot2) { + case (comm.Reddot17): + for k, v := range this.module.horoscope.Reddot(session, _rid) { reddot[int32(k)] = v } - case int32(comm.Reddot23), int32(comm.Reddot24), int32(comm.Reddot25): - for k, v := range this.module.martialhall.Reddot(session, comm.Reddot2) { + case (comm.Reddot19): + for k, v := range this.module.arena.Reddot(session, _rid) { + reddot[int32(k)] = v + } + case (comm.Reddot23), (comm.Reddot24), (comm.Reddot25): + for k, v := range this.module.martialhall.Reddot(session, _rid) { reddot[int32(k)] = v } } diff --git a/modules/reddot/api_getall.go b/modules/reddot/api_getall.go index f1cf72096..0c4cb4df6 100644 --- a/modules/reddot/api_getall.go +++ b/modules/reddot/api_getall.go @@ -36,7 +36,9 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq) for k, v := range this.module.martialhall.Reddot(session, comm.Reddot23, comm.Reddot24, comm.Reddot25) { reddot[int32(k)] = v } - + for k, v := range this.module.arena.Reddot(session, comm.Reddot19) { + reddot[int32(k)] = v + } session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot}) return } diff --git a/modules/reddot/module.go b/modules/reddot/module.go index 64da2c262..d48ff521f 100644 --- a/modules/reddot/module.go +++ b/modules/reddot/module.go @@ -24,6 +24,7 @@ type Reddot struct { pagoda comm.IPagoda martialhall comm.IMartialhall horoscope comm.IHoroscope + arena comm.IArena api_comp *apiComp } @@ -57,6 +58,10 @@ func (this *Reddot) Start() (err error) { return } this.horoscope = module.(comm.IHoroscope) + if module, err = this.service.GetModule(comm.ModuleArena); err != nil { + return + } + this.arena = module.(comm.IArena) return }