任务通知模块
This commit is contained in:
parent
1b613b0dd3
commit
790fea5ca1
@ -23,6 +23,7 @@ type apiComp struct {
|
|||||||
|
|
||||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
_ = this.MCompGate.Init(service, module, comp, options)
|
_ = this.MCompGate.Init(service, module, comp, options)
|
||||||
|
this.service = service.(base.IRPCXService)
|
||||||
this.module = module.(*Worldtask)
|
this.module = module.(*Worldtask)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package worldtask
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
@ -89,7 +90,7 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
|||||||
var isWin bool
|
var isWin bool
|
||||||
if code, isWin = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
|
if code, isWin = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
|
||||||
//触发任务
|
//触发任务
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype70, 1, req.BattleConfId)
|
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
|
||||||
if isWin {
|
if isWin {
|
||||||
if battleConf, ok := this.module.worldBattleConf.GetDataMap()[req.BattleConfId]; ok {
|
if battleConf, ok := this.module.worldBattleConf.GetDataMap()[req.BattleConfId]; ok {
|
||||||
if code := this.module.DispenseRes(session, []*cfg.Gameatn{battleConf.Playexp}, true); code != pb.ErrorCode_Success {
|
if code := this.module.DispenseRes(session, []*cfg.Gameatn{battleConf.Playexp}, true); code != pb.ErrorCode_Success {
|
||||||
@ -107,14 +108,28 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
|||||||
log.Field{Key: "战斗结果", Value: isWin},
|
log.Field{Key: "战斗结果", Value: isWin},
|
||||||
)
|
)
|
||||||
|
|
||||||
// 发奖
|
//判断是否配置了通知module
|
||||||
if code = this.module.DispenseRes(session, taskConf.Reword, true); code != pb.ErrorCode_Success {
|
if len(taskConf.Module) == 0 {
|
||||||
this.module.Error("资源发放",
|
// 发奖
|
||||||
log.Field{Key: "uid", Value: uid},
|
if code = this.module.DispenseRes(session, taskConf.Reword, true); code != pb.ErrorCode_Success {
|
||||||
log.Field{Key: "taskId", Value: req.TaskId},
|
this.module.Error("资源发放",
|
||||||
log.Field{Key: "reword", Value: taskConf.Reword},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "code", Value: code},
|
log.Field{Key: "taskId", Value: req.TaskId},
|
||||||
)
|
log.Field{Key: "reword", Value: taskConf.Reword},
|
||||||
|
log.Field{Key: "code", Value: code},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for _, m := range taskConf.Module {
|
||||||
|
i, err := this.service.GetModule(core.M_Modules(m))
|
||||||
|
if err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if ic, ok := i.(comm.ITaskComplete); ok {
|
||||||
|
ic.TaskComplete(session, req.TaskId)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package worldtask
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
@ -135,15 +136,29 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发奖
|
//判断是否配置了通知module
|
||||||
if code = this.module.DispenseRes(session, curTaskConf.Reword, true); code != pb.ErrorCode_Success {
|
if len(curTaskConf.Module) == 0 {
|
||||||
this.module.Error("资源发放",
|
// 发奖
|
||||||
log.Field{Key: "uid", Value: uid},
|
if code = this.module.DispenseRes(session, curTaskConf.Reword, true); code != pb.ErrorCode_Success {
|
||||||
log.Field{Key: "groupId", Value: req.GroupId},
|
this.module.Error("资源发放",
|
||||||
log.Field{Key: "taskId", Value: req.TaskId},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "reword", Value: curTaskConf.Reword},
|
log.Field{Key: "groupId", Value: req.GroupId},
|
||||||
log.Field{Key: "code", Value: code},
|
log.Field{Key: "taskId", Value: req.TaskId},
|
||||||
)
|
log.Field{Key: "reword", Value: curTaskConf.Reword},
|
||||||
|
log.Field{Key: "code", Value: code},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for _, m := range curTaskConf.Module {
|
||||||
|
i, err := this.service.GetModule(core.M_Modules(m))
|
||||||
|
if err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if ic, ok := i.(comm.ITaskComplete); ok {
|
||||||
|
ic.TaskComplete(session, req.TaskId)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user