上传任务代码

This commit is contained in:
liwei1dao 2023-03-11 17:52:12 +08:00
parent bdaad954b8
commit 1f371a9b44

View File

@ -278,62 +278,62 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
} }
//任务完成则推送 //任务完成则推送
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) module, err := this.service.GetModule(comm.ModuleWorldtask)
if err == nil { if err == nil {
go func() { // go func() {
defer func() { // defer func() {
if r := recover(); r != nil { // if r := recover(); r != nil {
log.Errorf("[worldtask ] err:%v ", r) // log.Errorf("[worldtask ] err:%v ", r)
} // }
}() // }()
if worldtask, ok := module.(comm.IWorldtask); ok { if worldtask, ok := module.(comm.IWorldtask); ok {
if err := worldtask.TaskcondNotify(session, conf.Id); err != nil { if err := worldtask.TaskcondNotify(session, conf.Id); err != nil {
log.Error("任务条件达成通知", log.Error("任务条件达成通知",
log.Field{Key: "uid", Value: uid}, log.Field{Key: "uid", Value: uid},
log.Field{Key: "condId", Value: conf.Id}, log.Field{Key: "condId", Value: conf.Id},
log.Field{Key: "err", Value: err.Error()}, log.Field{Key: "err", Value: err.Error()},
) )
}
} }
}() }
// }()
} }
userModule, err := this.service.GetModule(comm.ModuleUser) userModule, err := this.service.GetModule(comm.ModuleUser)
if err == nil { if err == nil {
go func() { // go func() {
defer func() { //程序异常 收集异常信息传递给前端显示 // defer func() { //程序异常 收集异常信息传递给前端显示
if r := recover(); r != nil { // if r := recover(); r != nil {
log.Errorf("[sociatytask ] err:%v ", r) // log.Errorf("[sociatytask ] err:%v ", r)
// }
// }()
// 公会
if user, ok := userModule.(comm.IUser); ok {
ex, err := user.GetUserExpand(uid)
if err == nil && ex.SociatyId != "" {
sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
if err != nil {
return
} }
}() if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
// 公会 if err2 := sociaty.TaskcondNotify(uid, ex.SociatyId, conf.Id); err2 != nil {
if user, ok := userModule.(comm.IUser); ok { log.Error("公会任务条件达成通知",
ex, err := user.GetUserExpand(uid) log.Field{Key: "uid", Value: uid},
if err == nil && ex.SociatyId != "" { log.Field{Key: "sociatyId", Value: ex.SociatyId},
sociatyModule, err := this.service.GetModule(comm.ModuleSociaty) log.Field{Key: "condId", Value: conf.Id},
if err != nil { log.Field{Key: "err", Value: err2.Error()},
return )
}
if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
if err2 := sociaty.TaskcondNotify(uid, ex.SociatyId, conf.Id); err2 != nil {
log.Error("公会任务条件达成通知",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "sociatyId", Value: ex.SociatyId},
log.Field{Key: "condId", Value: conf.Id},
log.Field{Key: "err", Value: err2.Error()},
)
}
this.processOneTask(session, comm.Rtype156, 1)
// if module, err := this.service.GetModule(comm.ModuleRtask); err == nil {
// if iRtask, ok := module.(comm.IRtask); ok {
// iRtask.SendToRtask(session, comm.Rtype156, 1)
// }
// }
} }
this.processOneTask(session, comm.Rtype156, 1)
// if module, err := this.service.GetModule(comm.ModuleRtask); err == nil {
// if iRtask, ok := module.(comm.IRtask); ok {
// iRtask.SendToRtask(session, comm.Rtype156, 1)
// }
// }
} }
} }
}() }
// }()
} }
} }