diff --git a/modules/rtask/help.go b/modules/rtask/help.go index 477a2a421..ec69d9fec 100644 --- a/modules/rtask/help.go +++ b/modules/rtask/help.go @@ -10,6 +10,11 @@ import ( ) func lenParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) { + if cfg.Data1 == 0 { + if len(vals) == 1 { + return 1, nil + } + } if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 && cfg.Data4 != 0 && cfg.Data5 != 0 { if len(vals) != 5 { err = errors.New(fmt.Sprintf("%v 参数个数不一致,期望5实际是%v", cfg.Id, len(vals))) diff --git a/modules/rtask/module.go b/modules/rtask/module.go index d6559ad5e..b688154dd 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -169,6 +169,13 @@ func (this *ModuleRtask) initRtaskVerifyHandle() { verify: this.modelRtaskRecord.verifyFirstGreatEqualParam, update: this.modelRtaskRecord.addUpdate, }) + case comm.Rtype109: + this.registerVerifyHandle(v.Id, &rtaskCondi{ + cfg: typeCfg, + find: this.modelRtaskRecord.equalParams, + verify: this.modelRtask.verifyRtype109, + update: this.modelRtaskRecord.overrideUpdate, + }) case comm.Rtype7, comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15, comm.Rtype19, comm.Rtype21, comm.Rtype24, comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38, diff --git a/modules/rtask/verifyHandle.go b/modules/rtask/verifyHandle.go index ea7cdd235..10b8d1937 100644 --- a/modules/rtask/verifyHandle.go +++ b/modules/rtask/verifyHandle.go @@ -343,3 +343,18 @@ func (this *ModelRtask) verifyRtype63(uid string, cfg *cfg.GameRdtaskCondiData) return } + +// 加入公会 +func (this *ModelRtask) verifyRtype109(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { + userModule, err := this.service.GetModule(comm.ModuleUser) + if err != nil { + return + } + + if um, y := userModule.(comm.IUser); y { + if user, err := um.GetUserExpand(uid); err == nil { + return user.SociatyId != "", nil + } + } + return +} diff --git a/modules/sociaty/api_cross_agree.go b/modules/sociaty/api_cross_agree.go index 43986c7ba..7427aaf17 100644 --- a/modules/sociaty/api_cross_agree.go +++ b/modules/sociaty/api_cross_agree.go @@ -51,6 +51,8 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) ( return } + // 触发任务条件 + this.module.ModuleRtask.SendToRtask(session, comm.Rtype109); // 发邮件 if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil { this.module.Error("发送邮件 模板ID:GuildApproved", log.Fields{"uid": uid, "申请人": req.Uid, "sociatyId": sociaty.Id}) diff --git a/modules/sociaty/api_cross_apply.go b/modules/sociaty/api_cross_apply.go index 993016c16..f662a585e 100644 --- a/modules/sociaty/api_cross_apply.go +++ b/modules/sociaty/api_cross_apply.go @@ -83,7 +83,8 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) ( } // 申请 - if err := this.module.modelSociaty.apply(uid, sociaty); err != nil { + isCheck, err := this.module.modelSociaty.apply(uid, sociaty) + if err != nil { var customError = new(comm.CustomError) if errors.As(err, &customError) { code = customError.Code @@ -93,6 +94,12 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) ( this.module.Error("公会申请", log.Fields{"uid": uid, "sociatyId": req.SociatyId, "err": err.Error()}) return } + + // 无需审核 + if !isCheck { + // 触发任务条件 + this.module.ModuleRtask.SendToRtask(session, comm.Rtype109) + } rsp := &pb.SociatyApplyResp{ Uid: uid, ScoiatyId: req.SociatyId, diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 1b9de59fb..69306c56e 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -232,9 +232,10 @@ func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) { } // 申请公会 -func (this *ModelSociaty) apply(uid string, sociaty *pb.DBSociaty) error { +func (this *ModelSociaty) apply(uid string, sociaty *pb.DBSociaty) (isCheck bool,err error) { // 判断公会审批设置 if sociaty.IsApplyCheck { //需要审核 + isCheck = true sociaty.ApplyRecord = append(sociaty.ApplyRecord, &pb.ApplyRecord{ Uid: uid, Ctime: configure.Now().Unix(), @@ -242,15 +243,15 @@ func (this *ModelSociaty) apply(uid string, sociaty *pb.DBSociaty) error { update := map[string]interface{}{ "applyRecord": sociaty.ApplyRecord, } - return this.updateSociaty(sociaty.Id, update) + err = this.updateSociaty(sociaty.Id, update) } else { //无需审核直接入会 if err := this.addMember(uid, sociaty); err != nil { - return err + return isCheck,err } //初始玩家公会任务 this.moduleSociaty.modelSociatyTask.initSociatyTask(uid, sociaty.Id) } - return nil + return } // 设置公会