更新任务校验接口调用

This commit is contained in:
wh_zcy 2023-05-31 13:41:46 +08:00
parent 6d560e4213
commit 4e70b9204a
7 changed files with 17 additions and 16 deletions

View File

@ -357,7 +357,7 @@ type (
// 设置工会活跃度 // 设置工会活跃度
BingoSetActivity(session IUserSession, activity int32) error BingoSetActivity(session IUserSession, activity int32) error
// 任务条件达成通知 // 任务条件达成通知
TaskcondNotify(uid string, condIds []int32) error // TaskcondNotify(uid string, condIds []int32) error
// 红点 // 红点
IReddot IReddot
} }

View File

@ -19,7 +19,7 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod
rsp := &pb.RtaskTestResp{Flag: true, RtaskType: req.RtaskType} rsp := &pb.RtaskTestResp{Flag: true, RtaskType: req.RtaskType}
// 校验 // 校验
if req.CondiId != 0 { if req.CondiId != 0 {
condIds, err := this.module.ModuleBuried.CheckCondition(session.GetUserId(), req.CondiId) condIds, _, err := this.module.ModuleBuried.CheckCondition(session.GetUserId(), req.CondiId)
if err == nil && len(condIds) > 0 { if err == nil && len(condIds) > 0 {
rsp.Flag = false rsp.Flag = false
} }

View File

@ -10,6 +10,7 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/base" "go_dreamfactory/lego/base"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -60,6 +61,7 @@ func (this *Sociaty) OnInstallComp() {
this.modelSociatyLog = this.RegisterComp(new(ModelSociatyLog)).(*ModelSociatyLog) this.modelSociatyLog = this.RegisterComp(new(ModelSociatyLog)).(*ModelSociatyLog)
this.modelSociatyBoss = this.RegisterComp(new(ModelSociatyBoss)).(*ModelSociatyBoss) this.modelSociatyBoss = this.RegisterComp(new(ModelSociatyBoss)).(*ModelSociatyBoss)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
event.Register(comm.EventBuriedComplete, this.TCondFinishNotify)
} }
func (this *Sociaty) Start() (err error) { func (this *Sociaty) Start() (err error) {
@ -239,15 +241,14 @@ type TaskParams struct {
} }
// 任务条件达成通知 // 任务条件达成通知
func (this *Sociaty) TaskcondNotify(uid string, condIds []int32) error { func (this *Sociaty) TCondFinishNotify(uid string, condIds []int32) {
// log.Debug("公会任务", log.Debug("公会任务",
// log.Field{Key: "uid", Value: uid}, log.Field{Key: "uid", Value: uid},
// log.Field{Key: "sociatyId", Value: sociatyId}, log.Field{Key: "condIds", Value: condIds})
// log.Field{Key: "condId", Value: condId})
sociaty := this.modelSociaty.getUserSociaty(uid) sociaty := this.modelSociaty.getUserSociaty(uid)
if sociaty == nil { if sociaty == nil {
return fmt.Errorf("公会未找到 uid:%v condIds:%v", uid, condIds) return
} }
sociatyId := sociaty.Id sociatyId := sociaty.Id
@ -267,7 +268,7 @@ func (this *Sociaty) TaskcondNotify(uid string, condIds []int32) error {
} }
} }
if !flag { if !flag {
return nil return
} }
update := map[string]interface{}{ update := map[string]interface{}{
@ -279,9 +280,9 @@ func (this *Sociaty) TaskcondNotify(uid string, condIds []int32) error {
comm.Service_Worker, string(comm.Rpc_ModuleSociatyTask), comm.Service_Worker, string(comm.Rpc_ModuleSociatyTask),
&TaskParams{SociatyId: sociatyId, Uid: uid, Data: update}, &pb.EmptyResp{}) &TaskParams{SociatyId: sociatyId, Uid: uid, Data: update}, &pb.EmptyResp{})
if err != nil { if err != nil {
return err return
} }
return nil return
} }
func (this *Sociaty) RpcUpdateUserTask(ctx context.Context, p *TaskParams, reply *pb.EmptyResp) error { func (this *Sociaty) RpcUpdateUserTask(ctx context.Context, p *TaskParams, reply *pb.EmptyResp) error {

View File

@ -90,7 +90,7 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
a.module.modelWorldtask.taskFinishPush(session, req.GroupId, myWorldtask, curTaskConf) a.module.modelWorldtask.taskFinishPush(session, req.GroupId, myWorldtask, curTaskConf)
} else { } else {
// 已完成的任务条件 // 已完成的任务条件
rsp.CondiIds, err = a.module.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...) rsp.CondiIds, _, err = a.module.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...)
if err == nil { if err == nil {
a.module.ModuleBuried.ActiveCondition(uid, utils.NoContain(rsp.CondiIds, curTaskConf.Completetask)...) a.module.ModuleBuried.ActiveCondition(uid, utils.NoContain(rsp.CondiIds, curTaskConf.Completetask)...)
} }

View File

@ -45,7 +45,7 @@ func (this *apiComp) CompleteCondi(session comm.IUserSession, req *pb.WorldtaskC
myWorldtask.Uid = uid myWorldtask.Uid = uid
wt := myWorldtask.CurrentTask[req.GroupId] wt := myWorldtask.CurrentTask[req.GroupId]
condIds, err := this.module.ModuleBuried.CheckCondition(uid, req.CondiId) condIds, _, err := this.module.ModuleBuried.CheckCondition(uid, req.CondiId)
if err == nil && len(condIds) > 0 { if err == nil && len(condIds) > 0 {
wt.CondiIds = append(wt.CondiIds, condIds...) wt.CondiIds = append(wt.CondiIds, condIds...)
} }

View File

@ -108,7 +108,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
if v, ok := userTask.CurrentTask[req.GroupId]; ok { if v, ok := userTask.CurrentTask[req.GroupId]; ok {
if _, ok := utils.Findx(v.CondiIds, condId); !ok { if _, ok := utils.Findx(v.CondiIds, condId); !ok {
// //
conIds, err := this.module.ModuleBuried.CheckCondition(uid, condId) conIds, _, err := this.module.ModuleBuried.CheckCondition(uid, condId)
if err == nil && len(conIds) > 0 { if err == nil && len(conIds) > 0 {
condiFlag = true condiFlag = true
} else { } else {
@ -206,7 +206,7 @@ func (this *apiComp) updateCheckCond(uid string, userTask *pb.DBWorldtask, nextT
} }
} }
condIds, err := this.module.ModuleBuried.CheckCondition(uid, condiId) condIds, _, err := this.module.ModuleBuried.CheckCondition(uid, condiId)
if err == nil && len(condIds) > 0 { if err == nil && len(condIds) > 0 {
nwt.CondiIds = condIds nwt.CondiIds = condIds
userTask.CurrentTask[nextTaskConf.Group] = nwt userTask.CurrentTask[nextTaskConf.Group] = nwt

View File

@ -227,7 +227,7 @@ func (this *ModelWorldtask) updateCheckCond(uid string, userLv int32, userTask *
// } // }
// } // }
// } // }
condIds, err := this.moduleWorldtask.ModuleBuried.CheckCondition(uid, condiId) condIds, _, err := this.moduleWorldtask.ModuleBuried.CheckCondition(uid, condiId)
if err == nil && len(condIds) > 0 { if err == nil && len(condIds) > 0 {
nwt.CondiIds = condIds nwt.CondiIds = condIds
userTask.CurrentTask[nextTaskConf.Group] = nwt userTask.CurrentTask[nextTaskConf.Group] = nwt