From fa35943a808ee359a6d79216d135915b4ac13b1a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 12 Sep 2023 19:11:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Egm=20=E8=A7=A3=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 1 + modules/gm/module.go | 17 +++++++++++++++++ modules/sys/module.go | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/comm/imodule.go b/comm/imodule.go index 205407074..4b9cd7461 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -46,6 +46,7 @@ type ( // 查询opencond 配置 CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData) QueryOpenCondData(uid string) (data map[string]int32, errdata *pb.ErrorData) // 查询玩家当前已开启的功能 + GMOpenAllCondition(uid string) } //邮件业务模块对外接口定义 提供给其他模块使用的 diff --git a/modules/gm/module.go b/modules/gm/module.go index 8928304eb..4da399992 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -774,6 +774,23 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, ) + } else if len(datas) == 1 && (datas[0] == "opencond") { + var ( + err error + ) + + module1, err := this.service.GetModule(comm.ModuleSys) + if err != nil { + return + } + + module1.(comm.ISys).GMOpenAllCondition(session.GetUserId()) + + this.Debug("使用bingo命令:uid = %s ", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "0", Value: datas[0]}, + ) + } } } diff --git a/modules/sys/module.go b/modules/sys/module.go index 7dd740e37..0080dd59d 100644 --- a/modules/sys/module.go +++ b/modules/sys/module.go @@ -167,3 +167,25 @@ func (this *ModuleSys) QueryOpenCondData(uid string) (data map[string]int32, err return } + +func (this *ModuleSys) GMOpenAllCondition(uid string) { + var ( + list *pb.DBOpenCond + ) + opencfg, err := this.configure.getOpencondCfg() + if err != nil { + + return + } + if list, err = this.modelSys.GetOpenCondList(uid); err != nil { + + return + } + for _, v := range opencfg.GetDataList() { + list.Cond[v.Id] = 2 + } + this.modelSys.ChangeOpenCondData(uid, map[string]interface{}{ + "cond": list.Cond, + }) + return +}