From 8e579dde24b760f7fafb339a3fd9db6366f7414c Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 6 Sep 2023 19:02:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0gm=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 12 +++++++----- modules/gm/module.go | 22 ++++++++++++++++++++++ modules/sociaty/module.go | 15 +++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 6845887c9..cdac2064c 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -360,12 +360,16 @@ type ( IGetReddot } IHunting interface { + IGetReddot CompleteAllLevel(session IUserSession) (errdata *pb.ErrorData) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录 - IGetReddot } // 公会 ISociaty interface { + // 任务条件达成通知 + IBuriedUpdateNotify + // 红点 + IGetReddot GetSociaty(uid string) *pb.DBSociaty //查询工会信息 GetSociatys(sociatyIds []string) (result []*pb.DBSociaty, errdata *pb.ErrorData) @@ -380,10 +384,8 @@ type ( BingoSetExp(session IUserSession, exp int32) error // 设置工会活跃度 BingoSetActivity(session IUserSession, activity int32) error - // 任务条件达成通知 - IBuriedUpdateNotify - // 红点 - IGetReddot + //修改公会等级 + ModifySociatyLv(uid string, lv int32) (err error) } //星座图 IHoroscope interface { diff --git a/modules/gm/module.go b/modules/gm/module.go index 72d5084a6..8fee0ca02 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -719,6 +719,28 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er module1.(comm.ILibrary).GMCreateFavorability(session.GetUserId()) + this.Debug("使用bingo命令:uid = %s ", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "0", Value: datas[0]}, + ) + } else if len(datas) == 2 && (datas[0] == "sociatylv") { + var ( + lv int + err error + ) + + module1, err := this.service.GetModule(comm.ModuleSociaty) + if err != nil { + return + } + lv, err = strconv.Atoi(datas[1]) + if err = module1.(comm.ISociaty).ModifySociatyLv(session.GetUserId(), int32(lv)); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ExternalModule, + Title: pb.ChatType_Moonfantasy.String(), + Message: err.Error(), + } + } this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go index 06a9cbab4..caa8b991e 100644 --- a/modules/sociaty/module.go +++ b/modules/sociaty/module.go @@ -419,3 +419,18 @@ func (this *Sociaty) CreateSociaty(uid, sociatyName string) error { func (this *Sociaty) GetSociaty(uid string) *pb.DBSociaty { return this.modelSociaty.getUserSociaty(uid) } + +func (this *Sociaty) ModifySociatyLv(uid string, lv int32) (err error) { + var ( + sociaty *pb.DBSociaty + ) + sociaty = this.modelSociaty.getUserSociaty(uid) + if sociaty != nil { + sociaty.Lv = lv + this.modelSociaty.updateSociaty(sociaty.Id, map[string]interface{}{ + "lv": lv, + }) + } + err = fmt.Errorf("no fund sociaty!") + return +}