package sys import ( "go_dreamfactory/comm" "go_dreamfactory/pb" ) func (this *apiComp) FuncGetListCheck(session comm.IUserSession, req *pb.SysFuncGetListReq) (errdata *pb.ErrorData) { return } func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetListReq) (errdata *pb.ErrorData) { var ( bChange bool ) rsp := &pb.SysFuncGetListResp{} rsp.Cond = make(map[string]int32, 0) opencfg, err := this.module.configure.getOpencondCfg() if err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, Message: err.Error(), } return } list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId()) if len(req.Keys) == 0 { for _, v := range opencfg.GetDataList() { if list.Cond[v.Id] == 0 { id := this.module.modelSys.validCond(session.GetUserId(), v) if id != "" { if v.ActivateType == 1 { // 需要手动激活的 list.Cond[id] = 1 //设置激活 } else { list.Cond[id] = 2 //自动激活 } bChange = true } } rsp.Cond[v.Id] = list.Cond[v.Id] } } else { for _, key := range req.Keys { if list.Cond[key] == 0 { if conf, ok := opencfg.GetDataMap()[key]; ok { id := this.module.modelSys.validCond(session.GetUserId(), conf) if id != "" { if conf.ActivateType == 1 { // 需要手动激活的 list.Cond[id] = 1 //设置激活 } else { list.Cond[id] = 2 //自动激活 } bChange = true } } } rsp.Cond[key] = list.Cond[key] } } if bChange { this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{ "cond": list.Cond, }) } session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp) return }