diff --git a/modules/task/model_active.go b/modules/task/model_active.go index 390e72bfb..046c9bb15 100644 --- a/modules/task/model_active.go +++ b/modules/task/model_active.go @@ -57,6 +57,21 @@ func (this *ModelTaskActive) getActiveListByTag(uid string, taskTag comm.TaskTag 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 func (this *ModelTaskActive) getUserActive(uid, id string, taskTag comm.TaskTag) *pb.DBTaskActive { record := this.getActiveListByTag(uid, taskTag) diff --git a/modules/task/module.go b/modules/task/module.go index b77c2fd57..47e4dc99c 100644 --- a/modules/task/module.go +++ b/modules/task/module.go @@ -23,14 +23,10 @@ type ModuleTask struct { modelTaskActive *ModelTaskActive api *apiComp configure *configureComp - - // taskHandleMap map[int32]taskHandle //任务处理器 } func NewModule() core.IModule { - return &ModuleTask{ - // taskHandleMap: make(map[int32]taskHandle), - } + return &ModuleTask{} } 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) { err = this.ModuleBase.Init(service, module, options) - // this.initTaskHandle() return } @@ -163,6 +158,14 @@ func (this *ModuleTask) Reddot(session comm.IUserSession, rid ...comm.ReddotType reddot[comm.Reddot4] = ok 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