新增gm 解锁

This commit is contained in:
meixiongfeng 2023-09-12 19:11:03 +08:00
parent 482112158b
commit fa35943a80
3 changed files with 40 additions and 0 deletions

View File

@ -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)
}
//邮件业务模块对外接口定义 提供给其他模块使用的

View File

@ -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]},
)
}
}
}

View File

@ -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
}