上传消息代码

This commit is contained in:
liwei1dao 2023-03-11 17:47:20 +08:00
parent af8de5362c
commit bdaad954b8
2 changed files with 60 additions and 57 deletions

View File

@ -410,15 +410,15 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
}
//任务完成则推送
if code := this.CheckCondi(uid, conf.Id); code == pb.ErrorCode_Success {
if code = this.CheckCondi(uid, conf.Id); code == pb.ErrorCode_Success {
module, err := this.service.GetModule(comm.ModuleWorldtask)
if err == nil {
go func() {
defer func() {
if r := recover(); r != nil {
log.Errorf("[worldtask ] err:%v ", r)
}
}()
// go func() {
// defer func() {
// if r := recover(); r != nil {
// log.Errorf("[worldtask ] err:%v ", r)
// }
// }()
// 世界任务
if worldtask, ok := module.(comm.IWorldtask); ok {
if err := worldtask.TaskcondNotify(session, conf.Id); err != nil {
@ -446,16 +446,16 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
}
}
}
}()
// }()
}
userModule, err := this.service.GetModule(comm.ModuleUser)
if err == nil {
go func() {
defer func() { //程序异常 收集异常信息传递给前端显示
if r := recover(); r != nil {
log.Errorf("[sociatytask ] err:%v ", r)
}
}()
// go func() {
// defer func() { //程序异常 收集异常信息传递给前端显示
// if r := recover(); r != nil {
// log.Errorf("[sociatytask ] err:%v ", r)
// }
// }()
// 公会
if user, ok := userModule.(comm.IUser); ok {
ex, err := user.GetUserExpand(session.GetUserId())
@ -481,7 +481,7 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
}
}
}
}()
// }()
}
}
}

View File

@ -99,6 +99,7 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e
this.Error("world_task config not found", logFields...)
return err
}
logFields = append(logFields, log.Field{Key: "id_after", Value: taskConf.IdAfter}, log.Field{Key: "des", Value: taskConf.Des})
if taskConf != nil {
if taskConf.Des == 2 { //只有世界任务才校验前置
if !this.modelWorldtask.IsPreFinished(userTask, taskConf) {
@ -136,6 +137,8 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e
}); err != nil {
logFields = append(logFields, log.Field{Key: "err", Value: err.Error()})
log.Error("任务条件达成推送", logFields...)
} else {
this.Debug("推送任务", log.Field{Key: "NextTaskId", Value: nextTaskId})
}
} else {
this.Debug("已经是最后一个任务了", logFields...)