From 1bdaa38367a701ddcf48defd6406ffbf6bcff511 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Fri, 7 Jul 2023 14:29:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=BB=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/worldtask/model_worldtask.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/worldtask/model_worldtask.go b/modules/worldtask/model_worldtask.go index 430eafb5d..dd201ce95 100644 --- a/modules/worldtask/model_worldtask.go +++ b/modules/worldtask/model_worldtask.go @@ -209,13 +209,21 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, userTask * this.moduleWorldtask.Debug("nextTaskIds", log.Field{Key: "nextTaskIds", Value: nextTaskIds}) nextTask := make(map[int32]*pb.Worldtasks) - for _, next := range nextTaskIds { - ut := this.updateCurrentTaskCond(session.GetUserId(), u.Lv, userTask, curTaskConf.Key, next) - if ut != nil { - for k, v := range ut.CurrentTasks { - nextTask[k] = v + if len(nextTask) > 0 { + for _, next := range nextTaskIds { + ut := this.updateCurrentTaskCond(session.GetUserId(), u.Lv, userTask, curTaskConf.Key, next) + if ut != nil { + for k, v := range ut.CurrentTasks { + nextTask[k] = v + } } } + } else { + nwt, ok := userTask.CurrentTasks[curTaskConf.Group] + if ok { + // 删除 + delete(nwt.TaskMap, curTaskConf.Key) + } } if nextTaskIds == nil { @@ -231,6 +239,7 @@ func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, userTask * userTask.Chapters = make(map[int32]int32) } userTask.Chapters[curTaskConf.Group] = 1 //已解锁待领取 + } } update := map[string]interface{}{