From afd86b95b0b7879ee7aa06dca7480a515b7bcec5 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 10 Apr 2023 15:49:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E8=A7=A3=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sys/api_activate.go | 5 +++-- modules/sys/api_getlist.go | 10 +++++----- modules/sys/config.go | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/sys/api_activate.go b/modules/sys/api_activate.go index 352004605..d4e1ca3dc 100644 --- a/modules/sys/api_activate.go +++ b/modules/sys/api_activate.go @@ -33,9 +33,10 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi } list.Cond[req.Cid] = 1 this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{ - "cond": list, + "cond": list.Cond, }) - if err := session.SendMsg(string(this.module.GetType()), SysSubTypeFunc, rsp); err != nil { + rsp.Cid = req.Cid + if err := session.SendMsg(string(this.module.GetType()), "funcactivate", rsp); err != nil { code = pb.ErrorCode_SystemError } diff --git a/modules/sys/api_getlist.go b/modules/sys/api_getlist.go index b01b7618a..a9ea32400 100644 --- a/modules/sys/api_getlist.go +++ b/modules/sys/api_getlist.go @@ -21,7 +21,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi for _, v := range confList { id := this.module.modelSys.validCond(session.GetUserId(), v) if id != "" { - rsp.Cond[id] = 0 + rsp.Cond[id] = 1 } } } else { @@ -33,7 +33,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi if conf, ok := opencfg.GetDataMap()[key]; ok { id := this.module.modelSys.validCond(session.GetUserId(), conf) if id != "" { - rsp.Cond[id] = 0 + rsp.Cond[id] = 1 } } } @@ -41,9 +41,9 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId()) for k, v := range list.Cond { - if _, ok := rsp.Cond[k]; ok { - rsp.Cond[k] = v - } + //if _, ok := rsp.Cond[k]; ok { + rsp.Cond[k] = v + //} } if err := session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp); err != nil { code = pb.ErrorCode_SystemError diff --git a/modules/sys/config.go b/modules/sys/config.go index c1660eb73..ced4517fc 100644 --- a/modules/sys/config.go +++ b/modules/sys/config.go @@ -18,6 +18,7 @@ type configureComp struct { func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompConfigure.Init(service, module, comp, options) this.LoadConfigure(gameOpencond, cfg.NewGameOpencond) + return } @@ -47,7 +48,7 @@ func (this *configureComp) getOpencondList() (list []*cfg.GameOpencondData) { if cfg, err := this.getOpencondCfg(); err == nil { list = cfg.GetDataList() } - return nil + return } // 通过cid 找数据 From edeffa6e88f38b072591289abe670da38c118c5d Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 10 Apr 2023 16:48:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sys/api_getlist.go | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/modules/sys/api_getlist.go b/modules/sys/api_getlist.go index a9ea32400..81a2adc0b 100644 --- a/modules/sys/api_getlist.go +++ b/modules/sys/api_getlist.go @@ -19,9 +19,14 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi if len(req.Keys) == 0 { confList := this.module.configure.getOpencondList() for _, v := range confList { - id := this.module.modelSys.validCond(session.GetUserId(), v) - if id != "" { - rsp.Cond[id] = 1 + if v.ActivateType == 0 { + id := this.module.modelSys.validCond(session.GetUserId(), v) + if id != "" { + rsp.Cond[id] = 1 + } + + } else { + rsp.Cond[v.Id] = 0 } } } else { @@ -31,9 +36,13 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi continue } if conf, ok := opencfg.GetDataMap()[key]; ok { - id := this.module.modelSys.validCond(session.GetUserId(), conf) - if id != "" { - rsp.Cond[id] = 1 + if conf.ActivateType == 0 { + id := this.module.modelSys.validCond(session.GetUserId(), conf) + if id != "" { + rsp.Cond[id] = 1 + } + } else { + rsp.Cond[conf.Id] = 0 } } } @@ -41,9 +50,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId()) for k, v := range list.Cond { - //if _, ok := rsp.Cond[k]; ok { rsp.Cond[k] = v - //} } if err := session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp); err != nil { code = pb.ErrorCode_SystemError