日/周活跃度红点

This commit is contained in:
wh_zcy 2022-11-22 11:02:51 +08:00
parent c6329afb7e
commit 81b413fba4
2 changed files with 24 additions and 6 deletions

View File

@ -57,6 +57,21 @@ func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag
return list return list
} }
// 查询完成的且未领取的任务 发现未领取返回true
func (this *ModelTaskActive) noReceiveTaskActive(uid string, taskTag comm.TaskTag) (bool, error) {
list := []*pb.DBTaskActive{}
if err := this.GetList(uid, &list); err != nil {
this.moduleTask.Errorf("getUserActiveList err:%v", err)
return false,err
}
for _, v := range list {
if v.Tag == int32(taskTag) && v.Received == 0 {
return true, nil
}
}
return false, nil
}
//获取玩家活跃记录 id 唯一ID //获取玩家活跃记录 id 唯一ID
func (this *ModelTaskActive) getUserActive(uid, id string, taskTag comm.TaskTag) *pb.DBTaskActive { func (this *ModelTaskActive) getUserActive(uid, id string, taskTag comm.TaskTag) *pb.DBTaskActive {
record := this.getActiveListByTag(uid, taskTag) record := this.getActiveListByTag(uid, taskTag)

View File

@ -23,14 +23,10 @@ type ModuleTask struct {
modelTaskActive *ModelTaskActive modelTaskActive *ModelTaskActive
api *apiComp api *apiComp
configure *configureComp configure *configureComp
// taskHandleMap map[int32]taskHandle //任务处理器
} }
func NewModule() core.IModule { func NewModule() core.IModule {
return &ModuleTask{ return &ModuleTask{}
// taskHandleMap: make(map[int32]taskHandle),
}
} }
func (this *ModuleTask) GetType() core.M_Modules { func (this *ModuleTask) GetType() core.M_Modules {
@ -43,7 +39,6 @@ func (this *ModuleTask) GetEventApp() *event_v2.App {
func (this *ModuleTask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *ModuleTask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options) err = this.ModuleBase.Init(service, module, options)
// this.initTaskHandle()
return return
} }
@ -163,6 +158,14 @@ func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType
reddot[comm.Reddot4] = ok reddot[comm.Reddot4] = ok
break break
} }
case comm.Reddot27:
if ok,_:= this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_DAILY);ok{
reddot[comm.Reddot27] = ok
}
case comm.Reddot28:
if ok,_:= this.modelTaskActive.noReceiveTaskActive(session.GetUserId(), comm.TASK_WEEKLY);ok{
reddot[comm.Reddot28] = ok
}
} }
} }
return return