更新任务结束逻辑
This commit is contained in:
parent
a8f3add1a7
commit
50e376655c
@ -22,16 +22,6 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.RtaskBattle
|
|||||||
|
|
||||||
this.moduleRtask.Debugf("随机任务请求 rtaskID:%v 完成 subtaskID:%v chooseID:%v", req.RtaskId, req.RtaskSubId, req.ChooseId)
|
this.moduleRtask.Debugf("随机任务请求 rtaskID:%v 完成 subtaskID:%v chooseID:%v", req.RtaskId, req.RtaskSubId, req.ChooseId)
|
||||||
|
|
||||||
defer func() {
|
|
||||||
rsp := &pb.RtaskFinishPush{
|
|
||||||
RtaskId: req.RtaskId,
|
|
||||||
}
|
|
||||||
if err := session.SendMsg(string(this.moduleRtask.GetType()), "finish", rsp); err != nil {
|
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
this.moduleRtask.Debugf("随机任务完成 rtaskID:%v subtaskID:%v chooseID:%v", req.RtaskId, req.RtaskSubId, req.ChooseId)
|
|
||||||
}()
|
|
||||||
|
|
||||||
// 获取当前任务配置
|
// 获取当前任务配置
|
||||||
conf := this.moduleRtask.configure.getRtaskById(req.RtaskId)
|
conf := this.moduleRtask.configure.getRtaskById(req.RtaskId)
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
@ -71,9 +61,6 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.RtaskBattle
|
|||||||
// 校验完成条件
|
// 校验完成条件
|
||||||
var checkCondi bool
|
var checkCondi bool
|
||||||
for _, v := range sideConf.EndTid {
|
for _, v := range sideConf.EndTid {
|
||||||
if v == -1 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), v); !ok {
|
if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), v); !ok {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.moduleRtask.Error(err.Error())
|
this.moduleRtask.Error(err.Error())
|
||||||
@ -124,5 +111,13 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.RtaskBattle
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsp := &pb.RtaskFinishPush{
|
||||||
|
RtaskId: req.RtaskId,
|
||||||
|
}
|
||||||
|
if err := session.SendMsg(string(this.moduleRtask.GetType()), "finish", rsp); err != nil {
|
||||||
|
code = pb.ErrorCode_SystemError
|
||||||
|
}
|
||||||
|
this.moduleRtask.Debugf("随机任务完成 rtaskID:%v subtaskID:%v chooseID:%v", req.RtaskId, req.RtaskSubId, req.ChooseId)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,8 @@ func (this *ModelRtask) checkHandle(uid string, frtaskIds []int32, conf *cfg.Gam
|
|||||||
|
|
||||||
// 确定选项前的校验
|
// 确定选项前的校验
|
||||||
func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok bool) {
|
func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok bool) {
|
||||||
if condiId == 0 {
|
if condiId <= 0 {
|
||||||
return errors.New("condiId is nil"), true
|
return nil, true
|
||||||
}
|
}
|
||||||
//验证限定条件
|
//验证限定条件
|
||||||
var condi *rtaskCondi
|
var condi *rtaskCondi
|
||||||
|
Loading…
Reference in New Issue
Block a user