上传消息代码
This commit is contained in:
parent
af8de5362c
commit
bdaad954b8
@ -410,78 +410,78 @@ 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)
|
||||
}
|
||||
}()
|
||||
// 世界任务
|
||||
if worldtask, ok := module.(comm.IWorldtask); ok {
|
||||
if err := worldtask.TaskcondNotify(session, conf.Id); err != nil {
|
||||
var customErr = new(comm.CustomError)
|
||||
if errors.As(err, &customErr) {
|
||||
notifyErr := &pb.NotifyErrorNotifyPush{
|
||||
ReqMainType: string(comm.ModuleWorldtask),
|
||||
ReqSubType: "finish",
|
||||
Message: "",
|
||||
}
|
||||
// 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 {
|
||||
var customErr = new(comm.CustomError)
|
||||
if errors.As(err, &customErr) {
|
||||
notifyErr := &pb.NotifyErrorNotifyPush{
|
||||
ReqMainType: string(comm.ModuleWorldtask),
|
||||
ReqSubType: "finish",
|
||||
Message: "",
|
||||
}
|
||||
|
||||
if customErr.Code == pb.ErrorCode_WorldtaskLvNotEnough {
|
||||
notifyErr.Code = pb.ErrorCode_WorldtaskLvNotEnough
|
||||
session.SendMsg(string(comm.ModuleWorldtask), "finish", notifyErr)
|
||||
} else if customErr.Code == pb.ErrorCode_UserSessionNobeing {
|
||||
notifyErr.Code = pb.ErrorCode_UserSessionNobeing
|
||||
session.SendMsg(string(comm.ModuleWorldtask), "finish", notifyErr)
|
||||
} else {
|
||||
log.Error("任务条件达成通知",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "condId", Value: conf.Id},
|
||||
log.Field{Key: "err", Value: err.Error()},
|
||||
)
|
||||
}
|
||||
if customErr.Code == pb.ErrorCode_WorldtaskLvNotEnough {
|
||||
notifyErr.Code = pb.ErrorCode_WorldtaskLvNotEnough
|
||||
session.SendMsg(string(comm.ModuleWorldtask), "finish", notifyErr)
|
||||
} else if customErr.Code == pb.ErrorCode_UserSessionNobeing {
|
||||
notifyErr.Code = pb.ErrorCode_UserSessionNobeing
|
||||
session.SendMsg(string(comm.ModuleWorldtask), "finish", notifyErr)
|
||||
} else {
|
||||
log.Error("任务条件达成通知",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "condId", Value: conf.Id},
|
||||
log.Field{Key: "err", Value: err.Error()},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
// }()
|
||||
}
|
||||
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())
|
||||
if err == nil && ex.SociatyId != "" {
|
||||
sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}()
|
||||
// 公会
|
||||
if user, ok := userModule.(comm.IUser); ok {
|
||||
ex, err := user.GetUserExpand(session.GetUserId())
|
||||
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 {
|
||||
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()},
|
||||
)
|
||||
}
|
||||
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()},
|
||||
)
|
||||
}
|
||||
if module, err := this.service.GetModule(comm.ModuleRtask); err == nil {
|
||||
if iRtask, ok := module.(comm.IRtask); ok {
|
||||
iRtask.SendToRtask(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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
// }()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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...)
|
||||
|
Loading…
Reference in New Issue
Block a user