This commit is contained in:
wh_zcy 2023-04-10 20:46:37 +08:00
parent bf56296aa6
commit c4f0e8fc26
2 changed files with 21 additions and 0 deletions

View File

@ -154,6 +154,8 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
}
finishRsp := func() {
this.module.modelWorldtask.updateRandomTask(session.GetUserId(), userTask)
nextTaskIds := this.module.modelWorldtask.findNextTasks(curTaskConf.Key)
this.module.Debug("nextTaskIds", log.Field{Key: "nextTaskIds", Value: nextTaskIds})

View File

@ -231,6 +231,8 @@ func (this *ModelWorldtask) updateCheckCond(uid string, userTask *pb.DBWorldtask
// 任务完成推送
func (this *ModelWorldtask) taskFinishPush(session comm.IUserSession, groupId int32, userTask *pb.DBWorldtask, curTaskConf *cfg.GameWorldTaskData) {
this.updateRandomTask(session.GetUserId(), userTask)
nextTaskIds := this.findNextTasks(curTaskConf.Key)
this.moduleWorldtask.Debug("nextTaskIds", log.Field{Key: "nextTaskIds", Value: nextTaskIds})
@ -353,6 +355,23 @@ func (this *ModelWorldtask) updateRandomTask(uid string, myWorldtask *pb.DBWorld
now := configure.Now().Unix()
update := make(map[string]interface{})
// 日常
if now-myWorldtask.DaliyRefreshTime >= 3600*24 {
dailyIds := this.randomTask(user.Lv, dailyDes, myWorldtask)
if len(dailyIds) > 0 {
for _, v := range dailyIds {
gwtd, err := this.moduleWorldtask.configure.getWorldtaskById(v)
if err != nil || gwtd == nil {
continue
}
myWorldtask.CurrentTask[gwtd.Group] = &pb.Worldtask{
TaskId: v,
TaskType: gwtd.Des,
}
}
update["daliyRefreshTime"] = configure.Now().Unix()
}
}
//周常
if now-myWorldtask.WeekRefreshTime >= 3600*24*7 {
weekIds := this.randomTask(user.Lv, weekDes, myWorldtask)