上传竞技场红点需求

This commit is contained in:
liwei1dao 2022-11-21 13:47:06 +08:00
parent c0c7bd3559
commit e119f1a6aa
6 changed files with 61 additions and 15 deletions

View File

@ -282,4 +282,9 @@ type (
// 任务完成通知 // 任务完成通知
TaskFinishNotify(uid string, taskId, groupId int32) error TaskFinishNotify(uid string, taskId, groupId int32) error
} }
//竞技场
IArena interface {
///红点
IReddot
}
) )

View File

@ -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
}

View File

@ -68,6 +68,21 @@ func (this *Arena) OnInstallComp() {
//比赛结算 //比赛结算
func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) { 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() 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
}

View File

@ -23,29 +23,34 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code
} }
for _, rid := range req.Rids { for _, rid := range req.Rids {
// reddot[v] = false // reddot[v] = false
switch rid { _rid := comm.ReddotType(rid)
case int32(comm.Reddot1): switch _rid {
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot1) { case comm.Reddot1:
for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
case int32(comm.Reddot2): case comm.Reddot2:
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
case int32(comm.Reddot3): case (comm.Reddot3):
for k, v := range this.module.ModuleSociaty.Reddot(session, comm.Reddot3) { for k, v := range this.module.ModuleSociaty.Reddot(session, _rid) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
case int32(comm.Reddot4): case (comm.Reddot4):
for k, v := range this.module.ModuleTask.Reddot(session, comm.Reddot2) { for k, v := range this.module.ModuleTask.Reddot(session, _rid) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
case int32(comm.Reddot17): case (comm.Reddot17):
for k, v := range this.module.horoscope.Reddot(session, comm.Reddot2) { for k, v := range this.module.horoscope.Reddot(session, _rid) {
reddot[int32(k)] = v reddot[int32(k)] = v
} }
case int32(comm.Reddot23), int32(comm.Reddot24), int32(comm.Reddot25): case (comm.Reddot19):
for k, v := range this.module.martialhall.Reddot(session, comm.Reddot2) { 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 reddot[int32(k)] = v
} }
} }

View File

@ -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) { for k, v := range this.module.martialhall.Reddot(session, comm.Reddot23, comm.Reddot24, comm.Reddot25) {
reddot[int32(k)] = v 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}) session.SendMsg(string(this.module.GetType()), "getall", &pb.ReddotGetAllResp{Reddot: reddot})
return return
} }

View File

@ -24,6 +24,7 @@ type Reddot struct {
pagoda comm.IPagoda pagoda comm.IPagoda
martialhall comm.IMartialhall martialhall comm.IMartialhall
horoscope comm.IHoroscope horoscope comm.IHoroscope
arena comm.IArena
api_comp *apiComp api_comp *apiComp
} }
@ -57,6 +58,10 @@ func (this *Reddot) Start() (err error) {
return return
} }
this.horoscope = module.(comm.IHoroscope) this.horoscope = module.(comm.IHoroscope)
if module, err = this.service.GetModule(comm.ModuleArena); err != nil {
return
}
this.arena = module.(comm.IArena)
return return
} }