This commit is contained in:
wh_zcy 2023-03-30 21:26:19 +08:00
parent fc3d8c552d
commit 62834cc22c
2 changed files with 21 additions and 14 deletions

View File

@ -47,7 +47,7 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
update := map[string]interface{}{
"currentTask": myWorldtask.CurrentTask,
}
if err := a.module.modelWorldtask.Change(uid, update); err != nil {
code = pb.ErrorCode_DBError
}
@ -57,5 +57,11 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
}
session.SendMsg(string(a.module.GetType()), "accept", rsp)
//判断是否要结束任务
if (len(curTaskConf.Completetask) == 1 && curTaskConf.Completetask[0] == 0) ||
len(curTaskConf.Completetask) == 0 {
}
return
}

View File

@ -100,6 +100,16 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
if condiId == 0 {
continue
}
nwt, ok := userTask.CurrentTask[nextTaskConf.Group]
if ok {
nwt.TaskId = nextTaskId
nwt.TaskType = nextTaskConf.Des
} else {
nwt = &pb.Worldtask{
TaskId: nextTaskId,
TaskType: nextTaskConf.Des,
}
}
if m, err := this.module.service.GetModule(comm.ModuleRtask); err == nil {
iwt, ok := m.(comm.IRtask)
if ok {
@ -108,28 +118,19 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
log.Field{Key: "uid", Value: uid},
log.Field{Key: "taskId", Value: nextTaskId},
log.Field{Key: "condiId", Value: condiId},
)
)
} else {
nwt, ok := userTask.CurrentTask[nextTaskConf.Group]
if ok {
nwt.TaskId = nextTaskId
nwt.TaskType = nextTaskConf.Des
nwt.CondiIds = append(nwt.CondiIds, condiId)
} else {
condiIds := []int32{condiId}
nwt = &pb.Worldtask{
TaskId: nextTaskId,
TaskType: nextTaskConf.Des,
CondiIds: condiIds,
}
nwt.CondiIds = condiIds
}
userTask.CurrentTask[nextTaskConf.Group] = nwt
update["currentTask"] = userTask.CurrentTask
}
}
}
userTask.CurrentTask[nextTaskConf.Group] = nwt
update["currentTask"] = userTask.CurrentTask
}
}