上传红点接口优化

This commit is contained in:
liwei1dao 2022-11-21 10:34:25 +08:00
parent 48be5c295e
commit 59449e24cc
8 changed files with 47 additions and 26 deletions

View File

@ -4,6 +4,12 @@ import (
"go_dreamfactory/pb" "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) ModifyMainlineData(uid string, id int32) (code pb.ErrorCode)
/// 查询章节ID /// 查询章节ID
GetUsermainLineData(uid string) (mainlineId int32) GetUsermainLineData(uid string) (mainlineId int32)
///红点
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool IReddot
} }
//任务 //任务
ITask interface { ITask interface {
@ -142,8 +148,8 @@ type (
GetTaskById(uid string, taskId int32) *pb.DBTask GetTaskById(uid string, taskId int32) *pb.DBTask
// 获取已完成的任务列表 // 获取已完成的任务列表
GetTaskFinished(uid string, taskType TaskTag) []*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 { IPagoda interface {
ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode) ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode)
CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录 CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录
///红点
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool IReddot
} }
IHeroFetter interface { IHeroFetter interface {
@ -237,13 +243,15 @@ type (
MembersByUid(uid string) (list []*pb.SociatyMemberInfo) MembersByUid(uid string) (list []*pb.SociatyMemberInfo)
// 获取公会成员 // 获取公会成员
MembersBySociatyId(sociatyId string) (list []*pb.SociatyMemberInfo) MembersBySociatyId(sociatyId string) (list []*pb.SociatyMemberInfo)
//红点 ///红点
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool IReddot
} }
//星座图 //星座图
IHoroscope interface { IHoroscope interface {
//计算新作图属性 //计算新作图属性
ComputeHeroNumeric(uid string, hero ...*pb.DBHero) ComputeHeroNumeric(uid string, hero ...*pb.DBHero)
///红点
IReddot
} }
IPrivilege interface { IPrivilege interface {
// 创建一个新的特权卡 // 创建一个新的特权卡
@ -257,7 +265,8 @@ type (
} }
//武馆 //武馆
IMartialhall interface { IMartialhall interface {
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool ///红点
IReddot
} }
// 世界任务 // 世界任务
IWorldtask interface { IWorldtask interface {

View File

@ -57,3 +57,15 @@ func (this *Horoscope) ComputeHeroNumeric(uid string, hero ...*pb.DBHero) {
this.modelHoroscope.computeHeroNumeric(uid, hero...) this.modelHoroscope.computeHeroNumeric(uid, hero...)
return 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
}

View File

@ -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) reddot = make(map[comm.ReddotType]bool)
for _, v := range rid { for _, v := range rid {
if v == comm.Reddot5 { if v == comm.Reddot5 {
reddot[comm.Reddot5] = this.CheckPoint(uid) reddot[comm.Reddot5] = this.CheckPoint(session.GetUserId())
break break
} }
} }

View File

@ -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) reddot = make(map[comm.ReddotType]bool)
return return

View File

@ -25,19 +25,19 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code
// reddot[v] = false // reddot[v] = false
switch rid { switch rid {
case int32(comm.Reddot1): 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 reddot[int32(k)] = v
} }
case int32(comm.Reddot2): 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 reddot[int32(k)] = v
} }
case int32(comm.Reddot3): 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 reddot[int32(k)] = v
} }
case int32(comm.Reddot4): 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 reddot[int32(k)] = v
} }
} }

View File

@ -21,13 +21,13 @@ func (this *apiComp) GetAll(session comm.IUserSession, req *pb.ReddotGetAllReq)
if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success { if code = this.GetAllCheck(session, req); code != pb.ErrorCode_Success {
return 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 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 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 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})

View File

@ -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) reddot = make(map[comm.ReddotType]bool)
sociaty := this.modelSociaty.getUserSociaty(uid) sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
if sociaty == nil || sociaty.Id == "" { if sociaty == nil || sociaty.Id == "" {
reddot[comm.Reddot3] = false reddot[comm.Reddot3] = false
return return
@ -129,7 +129,7 @@ func (this *Sociaty) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm
for _, v := range rid { for _, v := range rid {
switch v { switch v {
case comm.Reddot3: case comm.Reddot3:
if ok := this.modelSociaty.IsSign(uid, sociaty); !ok { if ok := this.modelSociaty.IsSign(session.GetUserId(), sociaty); !ok {
reddot[comm.Reddot3] = true reddot[comm.Reddot3] = true
} }
} }

View File

@ -143,23 +143,23 @@ func (this *ModuleTask) GetTaskFinished(uid string, taskTage comm.TaskTag) []*pb
return this.modelTask.getFinishTasks(uid, taskTage) 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) reddot = make(map[comm.ReddotType]bool)
for _, v := range rid { for _, v := range rid {
switch v { switch v {
case comm.Reddot1: 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 reddot[comm.Reddot1] = ok
break break
} }
case comm.Reddot2: 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 reddot[comm.Reddot2] = ok
break break
} }
case comm.Reddot4: 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 reddot[comm.Reddot4] = ok
break break
} }