88 lines
2.5 KiB
Go
88 lines
2.5 KiB
Go
package sys
|
|
|
|
// import (
|
|
// "fmt"
|
|
// "go_dreamfactory/comm"
|
|
// "go_dreamfactory/lego/core"
|
|
// "go_dreamfactory/pb"
|
|
// cfg "go_dreamfactory/sys/configure/structs"
|
|
// )
|
|
|
|
// func (this *apiComp) FuncActivateCheck(session comm.IUserSession, req *pb.SysFuncActivateReq) (errdata *pb.ErrorData) {
|
|
// return
|
|
// }
|
|
|
|
// // cond 值 为0 表示功能未开启 1 功能开启 需要手动激活 2 功能开启并激活
|
|
// func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActivateReq) (errdata *pb.ErrorData) {
|
|
// var (
|
|
// conf *cfg.GameOpencondData
|
|
// info *pb.DBOpenCond
|
|
// condis []*pb.ConIProgress
|
|
// ok bool
|
|
// err error
|
|
// )
|
|
// rsp := &pb.SysFuncActivateResp{}
|
|
// if conf, err = this.module.configure.GetOpenCondCfgById(req.Cid); err != nil {
|
|
// errdata = &pb.ErrorData{
|
|
// Code: pb.ErrorCode_ConfigNoFound,
|
|
// Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
// Message: req.Cid,
|
|
// }
|
|
// return
|
|
// }
|
|
|
|
// if info, err = this.module.modelSys.GetOpenCondList(session.GetUserId()); err != nil {
|
|
// errdata = &pb.ErrorData{
|
|
// Code: pb.ErrorCode_DBError,
|
|
// Title: pb.ErrorCode_DBError.ToString(),
|
|
// Message: err.Error(),
|
|
// }
|
|
// return
|
|
// }
|
|
// if v, ok := info.Cond[req.Cid]; !ok || v != 1 {
|
|
// errdata = &pb.ErrorData{
|
|
// Code: pb.ErrorCode_OpenCondActivate,
|
|
// Title: pb.ErrorCode_OpenCondActivate.ToString(),
|
|
// }
|
|
// return
|
|
// }
|
|
// if ok, condis, _ = this.module.ModuleBuried.CheckCondition(session, conf.Opencondi...); !ok { // 条件不满足
|
|
// errdata = &pb.ErrorData{
|
|
// Code: pb.ErrorCode_OpenCondErr,
|
|
// Title: pb.ErrorCode_OpenCondErr.ToString(),
|
|
// Message: fmt.Sprintln(condis),
|
|
// }
|
|
// return
|
|
// }
|
|
|
|
// info.Cond[req.Cid] = 2
|
|
// this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{
|
|
// "cond": info.Cond,
|
|
// })
|
|
// rsp.Cid = req.Cid
|
|
// if err := session.SendMsg(string(this.module.GetType()), "funcactivate", rsp); err != nil {
|
|
// errdata = &pb.ErrorData{
|
|
// Code: pb.ErrorCode_SystemError,
|
|
// Title: pb.ErrorCode_SystemError.ToString(),
|
|
// Message: err.Error(),
|
|
// }
|
|
// return
|
|
// }
|
|
|
|
// go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
|
// //手动激活通知模块
|
|
// for _, m := range conf.Notify {
|
|
// i, err := this.service.GetModule(core.M_Modules(m))
|
|
// if err != nil {
|
|
// this.module.Errorln(err)
|
|
// continue
|
|
// }
|
|
// if ic, ok := i.(comm.IOpenCmdNotice); ok {
|
|
// ic.OpenCmdNotice(session, req.Cid)
|
|
// }
|
|
// }
|
|
// })
|
|
|
|
// return
|
|
// }
|