条件开启功能优化
This commit is contained in:
parent
fd1cbff425
commit
ab9ec2a86b
@ -1067,8 +1067,10 @@ const (
|
|||||||
type OpencondType int32
|
type OpencondType int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
OpencondTypePlatlv OpencondType = 1
|
OpencondTypePlatlv OpencondType = 1 //玩家等级
|
||||||
OpencondTypeMaxmapid OpencondType = 2
|
OpencondTypeMaxmapid OpencondType = 2 //主线进度
|
||||||
OpencondTypeWorldtaskid OpencondType = 3
|
OpencondTypeWorldtaskid OpencondType = 3 //世界任务
|
||||||
OpencondTypeFriend OpencondType = 4
|
OpencondTypeFriend OpencondType = 4 //好友数量
|
||||||
|
OpencondTypePagoda OpencondType = 5 //爬塔
|
||||||
|
OpencondTypeSociaty OpencondType = 6 //工会等级
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,6 @@ type (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
ISys interface {
|
ISys interface {
|
||||||
ValidCond(uid string, conf *cfg.GameOpencondData) string
|
|
||||||
CheckOpenCond(session IUserSession, itype OpencondType, value int32)
|
CheckOpenCond(session IUserSession, itype OpencondType, value int32)
|
||||||
|
|
||||||
// 查询opencond 配置
|
// 查询opencond 配置
|
||||||
|
@ -12,23 +12,22 @@ func (this *apiComp) FuncActivateCheck(session comm.IUserSession, req *pb.SysFun
|
|||||||
|
|
||||||
// cond 值 为0 表示功能未开启 1 功能开启 需要手动激活 2 功能开启并激活
|
// cond 值 为0 表示功能未开启 1 功能开启 需要手动激活 2 功能开启并激活
|
||||||
func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActivateReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActivateReq) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
list *pb.DBOpenCond
|
||||||
|
err error
|
||||||
|
)
|
||||||
rsp := &pb.SysFuncActivateResp{}
|
rsp := &pb.SysFuncActivateResp{}
|
||||||
|
opencfg, err := this.module.configure.GetOpenCondCfgById(req.Cid)
|
||||||
|
if err == nil {
|
||||||
|
|
||||||
opencfg := this.module.configure.getOpencondCfgByCid(req.Cid)
|
if list, err = this.module.modelSys.GetOpenCondList(session.GetUserId()); err != nil {
|
||||||
if opencfg != nil {
|
|
||||||
if id := this.module.modelSys.validCond(session.GetUserId(), opencfg); id == "" { // 条件不满足
|
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_OpenCondErr,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_OpenCondErr.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: req.Cid,
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId())
|
|
||||||
|
|
||||||
if v, ok := list.Cond[req.Cid]; !ok || v != 1 {
|
if v, ok := list.Cond[req.Cid]; !ok || v != 1 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_OpenCondActivate,
|
Code: pb.ErrorCode_OpenCondActivate,
|
||||||
@ -36,6 +35,23 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if id := this.module.modelSys.CheckValidCond(session.GetUserId(), opencfg, list); id == "" { // 条件不满足
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_OpenCondErr,
|
||||||
|
Title: pb.ErrorCode_OpenCondErr.ToString(),
|
||||||
|
Message: req.Cid,
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: req.Cid,
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
list.Cond[req.Cid] = 2
|
list.Cond[req.Cid] = 2
|
||||||
this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{
|
this.module.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{
|
||||||
"cond": list.Cond,
|
"cond": list.Cond,
|
||||||
|
@ -38,7 +38,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi
|
|||||||
for _, v := range opencfg.GetDataList() {
|
for _, v := range opencfg.GetDataList() {
|
||||||
if list.Cond[v.Id] == 0 {
|
if list.Cond[v.Id] == 0 {
|
||||||
|
|
||||||
id := this.module.modelSys.validCond(session.GetUserId(), v)
|
id := this.module.modelSys.CheckValidCond(session.GetUserId(), v, list)
|
||||||
if id != "" {
|
if id != "" {
|
||||||
if v.ActivateType == 1 { // 需要手动激活的
|
if v.ActivateType == 1 { // 需要手动激活的
|
||||||
list.Cond[id] = 1 //设置激活
|
list.Cond[id] = 1 //设置激活
|
||||||
@ -55,7 +55,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi
|
|||||||
for _, key := range req.Keys {
|
for _, key := range req.Keys {
|
||||||
if list.Cond[key] == 0 {
|
if list.Cond[key] == 0 {
|
||||||
if conf, ok := opencfg.GetDataMap()[key]; ok {
|
if conf, ok := opencfg.GetDataMap()[key]; ok {
|
||||||
id := this.module.modelSys.validCond(session.GetUserId(), conf)
|
id := this.module.modelSys.CheckValidCond(session.GetUserId(), conf, list)
|
||||||
if id != "" {
|
if id != "" {
|
||||||
if conf.ActivateType == 1 { // 需要手动激活的
|
if conf.ActivateType == 1 { // 需要手动激活的
|
||||||
list.Cond[id] = 1 //设置激活
|
list.Cond[id] = 1 //设置激活
|
||||||
|
@ -5,9 +5,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -17,78 +15,16 @@ const (
|
|||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
modules.MCompConfigure
|
modules.MCompConfigure
|
||||||
module *ModuleSys
|
module *ModuleSys
|
||||||
|
|
||||||
hlock sync.RWMutex
|
|
||||||
maplv map[int32][]string // 监听等级大于1 的配置
|
|
||||||
maptask map[int32][]string
|
|
||||||
mapmline map[int32][]string
|
|
||||||
mapfriend map[int32][]string // 好友数量
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
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)
|
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||||
//this.LoadConfigure(gameOpencond, cfg.NewGameOpencond)
|
this.LoadConfigure(gameOpencond, cfg.NewGameOpencond)
|
||||||
configure.RegisterConfigure(gameOpencond, cfg.NewGameOpencond, this.LoadCondConfig)
|
|
||||||
this.module = module.(*ModuleSys)
|
this.module = module.(*ModuleSys)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *configureComp) LoadCondConfig() {
|
|
||||||
|
|
||||||
if v, err := this.GetConfigure(gameOpencond); err == nil {
|
|
||||||
|
|
||||||
if data, ok := v.(*cfg.GameOpencond); ok {
|
|
||||||
this.hlock.Lock()
|
|
||||||
this.maplv = make(map[int32][]string, 0)
|
|
||||||
this.maptask = make(map[int32][]string, 0)
|
|
||||||
this.mapmline = make(map[int32][]string, 0)
|
|
||||||
this.mapfriend = make(map[int32][]string, 0)
|
|
||||||
defer this.hlock.Unlock()
|
|
||||||
for _, v := range data.GetDataList() {
|
|
||||||
for _, v1 := range v.Main {
|
|
||||||
if v.ActivateType == 2 {
|
|
||||||
if v1.Key == 1 && v1.Param > 1 {
|
|
||||||
this.maplv[v1.Param] = append(this.maplv[v1.Param], v.Id)
|
|
||||||
}
|
|
||||||
if v1.Key == 3 && v1.Param > 1 {
|
|
||||||
this.maptask[v1.Param] = append(this.maptask[v1.Param], v.Id)
|
|
||||||
}
|
|
||||||
if v1.Key == 2 && v1.Param > 1 {
|
|
||||||
this.mapmline[v1.Param] = append(this.mapmline[v1.Param], v.Id)
|
|
||||||
}
|
|
||||||
if v1.Key == 4 && v1.Param > 1 {
|
|
||||||
this.mapfriend[v1.Param] = append(this.mapfriend[v1.Param], v.Id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *configureComp) GetOpencondLv(lv int32) []string {
|
|
||||||
this.hlock.RLock()
|
|
||||||
defer this.hlock.RUnlock()
|
|
||||||
return this.maplv[lv]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *configureComp) getOpencondMline(id int32) []string {
|
|
||||||
this.hlock.RLock()
|
|
||||||
defer this.hlock.RUnlock()
|
|
||||||
return this.mapmline[id]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *configureComp) getOpencondTask(id int32) []string {
|
|
||||||
this.hlock.RLock()
|
|
||||||
defer this.hlock.RUnlock()
|
|
||||||
return this.maptask[id]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *configureComp) getFriendTask(id int32) []string {
|
|
||||||
this.hlock.RLock()
|
|
||||||
defer this.hlock.RUnlock()
|
|
||||||
return this.mapfriend[id]
|
|
||||||
}
|
|
||||||
func (this *configureComp) getOpencondCfg() (data *cfg.GameOpencond, err error) {
|
func (this *configureComp) getOpencondCfg() (data *cfg.GameOpencond, err error) {
|
||||||
var (
|
var (
|
||||||
v interface{}
|
v interface{}
|
||||||
@ -114,7 +50,6 @@ func (this *configureComp) GetOpenCondCfgById(id string) (data *cfg.GameOpencond
|
|||||||
if data = c.Get(id); data != nil {
|
if data = c.Get(id); data != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,17 +63,3 @@ func (this *configureComp) getOpencondConf() (list []*cfg.GameOpencondData) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过cid 找数据
|
|
||||||
func (this *configureComp) getOpencondCfgByCid(id string) (conf *cfg.GameOpencondData) {
|
|
||||||
|
|
||||||
if v, err := this.GetConfigure(gameOpencond); err == nil {
|
|
||||||
|
|
||||||
if data, ok := v.(*cfg.GameOpencond); ok {
|
|
||||||
if conf, ok = data.GetDataMap()[id]; ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
@ -26,69 +26,6 @@ func (this *ModelSys) Init(service core.IService, module core.IModule, comp core
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelSys) validCond(uid string, condData *cfg.GameOpencondData) string {
|
|
||||||
for _, conf := range condData.Main {
|
|
||||||
switch conf.Key {
|
|
||||||
case 1: //等级
|
|
||||||
if conf.Param == 1 { // 等级为1 直接过
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
iuser := this.moduleSys.ModuleUser
|
|
||||||
user := iuser.GetUser(uid)
|
|
||||||
if user == nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if user.Lv < conf.Param {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
case 2: //关卡ID
|
|
||||||
// 查询主线进度
|
|
||||||
if levels := this.moduleSys.mainline.InquireMainLinePassLevel(uid); len(levels) > 0 {
|
|
||||||
if _, ok := levels[conf.Param]; !ok {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
case 3: //世界任务ID
|
|
||||||
d := this.moduleSys.wtask.InquireCompletes(uid)
|
|
||||||
ok := false
|
|
||||||
for _, taskId := range d {
|
|
||||||
if taskId == conf.Param {
|
|
||||||
ok = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !ok {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
module, err := this.service.GetModule(comm.ModuleFriend)
|
|
||||||
if err != nil {
|
|
||||||
this.moduleSys.Debugln(err)
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
if v, ok := module.(comm.IFriend); ok {
|
|
||||||
if v.GetFriendCount(uid) < conf.Param {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 5:
|
|
||||||
if !this.moduleSys.pagoda.CheckCompletePagoda(uid) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
case 6: // 查询工会等级
|
|
||||||
if s := this.moduleSys.sociaty.GetSociaty(uid); s != nil {
|
|
||||||
if s.Lv < conf.Param {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return condData.Id
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *ModelSys) GetOpenCondList(uid string) (result *pb.DBOpenCond, err error) {
|
func (this *ModelSys) GetOpenCondList(uid string) (result *pb.DBOpenCond, err error) {
|
||||||
result = &pb.DBOpenCond{}
|
result = &pb.DBOpenCond{}
|
||||||
if err = this.Get(uid, result); err != nil {
|
if err = this.Get(uid, result); err != nil {
|
||||||
@ -97,6 +34,12 @@ func (this *ModelSys) GetOpenCondList(uid string) (result *pb.DBOpenCond, err er
|
|||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
Cond: map[string]int32{},
|
Cond: map[string]int32{},
|
||||||
|
Lv: 1,
|
||||||
|
Friend: 0,
|
||||||
|
Mline: map[int32]int32{},
|
||||||
|
Wtask: map[int32]int32{},
|
||||||
|
Pagoda: map[int32]int32{},
|
||||||
|
Sociaty: 1,
|
||||||
}
|
}
|
||||||
this.Add(uid, result)
|
this.Add(uid, result)
|
||||||
err = nil
|
err = nil
|
||||||
@ -112,3 +55,36 @@ func (this *ModelSys) ChangeOpenCondData(uid string, value map[string]interface{
|
|||||||
}
|
}
|
||||||
return this.Change(uid, value)
|
return this.Change(uid, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ModelSys) CheckValidCond(uid string, condData *cfg.GameOpencondData, open *pb.DBOpenCond) string {
|
||||||
|
for _, conf := range condData.Main {
|
||||||
|
switch conf.Key {
|
||||||
|
case 1: //等级
|
||||||
|
if open.Lv < conf.Param {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
case 2: //关卡ID
|
||||||
|
if _, ok := open.Mline[conf.Param]; !ok {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
case 3: //世界任务ID
|
||||||
|
if _, ok := open.Wtask[conf.Param]; !ok {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
case 4: // 好友数量
|
||||||
|
if open.Friend < conf.Param {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
case 5:
|
||||||
|
if _, ok := open.Pagoda[conf.Param]; !ok {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
case 6: // 查询工会等级
|
||||||
|
if open.Sociaty < conf.Param {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return condData.Id
|
||||||
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ comm.ISys = (*ModuleSys)(nil)
|
var _ comm.ISys = (*ModuleSys)(nil)
|
||||||
@ -74,55 +73,54 @@ func (this *ModuleSys) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string {
|
|
||||||
return this.modelSys.validCond(uid, conf)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *ModuleSys) CheckOpenCond(session comm.IUserSession, itype comm.OpencondType, value int32) {
|
func (this *ModuleSys) CheckOpenCond(session comm.IUserSession, itype comm.OpencondType, value int32) {
|
||||||
|
var (
|
||||||
|
list *pb.DBOpenCond
|
||||||
|
err error
|
||||||
|
update map[string]interface{}
|
||||||
|
)
|
||||||
|
if list, err = this.modelSys.GetOpenCondList(session.GetUserId()); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
update = make(map[string]interface{})
|
||||||
switch itype {
|
switch itype {
|
||||||
case comm.OpencondTypePlatlv:
|
case comm.OpencondTypePlatlv:
|
||||||
|
if list.Lv != value {
|
||||||
|
list.Lv = value
|
||||||
|
update["lv"] = list.Lv
|
||||||
|
}
|
||||||
case comm.OpencondTypeMaxmapid:
|
case comm.OpencondTypeMaxmapid:
|
||||||
|
list.Mline[value] = 1
|
||||||
|
update["mline"] = list.Mline
|
||||||
case comm.OpencondTypeWorldtaskid:
|
case comm.OpencondTypeWorldtaskid:
|
||||||
|
list.Wtask[value] = 1
|
||||||
|
update["wtask"] = list.Wtask
|
||||||
case comm.OpencondTypeFriend:
|
case comm.OpencondTypeFriend:
|
||||||
|
if list.Friend != value {
|
||||||
|
list.Friend = value
|
||||||
|
update["friend"] = list.Friend
|
||||||
}
|
}
|
||||||
|
case comm.OpencondTypePagoda:
|
||||||
|
list.Pagoda[value] = 1
|
||||||
|
update["pagoda"] = list.Pagoda
|
||||||
|
case comm.OpencondTypeSociaty:
|
||||||
|
if list.Sociaty != value {
|
||||||
|
list.Sociaty = value
|
||||||
|
update["friend"] = list.Friend
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
// 自动激活
|
return
|
||||||
func (this *ModuleSys) AutoActivate(session comm.IUserSession, cids []string) bool {
|
|
||||||
var (
|
|
||||||
szOpen []string
|
|
||||||
)
|
|
||||||
list, _ := this.modelSys.GetOpenCondList(session.GetUserId())
|
|
||||||
for _, cid := range cids {
|
|
||||||
opencfg := this.configure.getOpencondCfgByCid(cid)
|
|
||||||
if opencfg == nil {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if id := this.modelSys.validCond(session.GetUserId(), opencfg); id == "" { // 条件不满足
|
if err = this.modelSys.ChangeOpenCondData(session.GetUserId(), update); err != nil {
|
||||||
continue
|
this.Errorf("ChangeOpenCondData error: %v", err)
|
||||||
} else {
|
|
||||||
if _, ok := list.Cond[cid]; !ok {
|
|
||||||
list.Cond[cid] = 1
|
|
||||||
szOpen = append(szOpen, cid)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(szOpen) > 0 {
|
|
||||||
this.modelSys.ChangeOpenCondData(session.GetUserId(), map[string]interface{}{
|
|
||||||
"cond": list.Cond,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// 推送变化
|
|
||||||
session.SendMsg(string(this.GetType()), "open", &pb.SysFuncOpnePush{
|
|
||||||
Cid: szOpen,
|
|
||||||
})
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// 功能开启条件校验
|
// 功能开启条件校验
|
||||||
func (this *ModuleSys) CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData) {
|
func (this *ModuleSys) CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
list *pb.DBOpenCond
|
||||||
|
)
|
||||||
conf, err := this.configure.GetOpenCondCfgById(id)
|
conf, err := this.configure.GetOpenCondCfgById(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
bOpen = false
|
bOpen = false
|
||||||
@ -133,7 +131,17 @@ func (this *ModuleSys) CheckOpenCondCfgById(uid string, id string) (bOpen bool,
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if this.ValidCond(uid, conf) != "" {
|
|
||||||
|
if list, err = this.modelSys.GetOpenCondList(uid); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, ok := list.Cond[id]; ok { // 数据过滤
|
||||||
|
if list.Cond[id] > 0 {
|
||||||
|
bOpen = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.modelSys.CheckValidCond(uid, conf, list) != "" {
|
||||||
bOpen = true
|
bOpen = true
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
106
pb/sys_db.pb.go
106
pb/sys_db.pb.go
@ -28,6 +28,12 @@ type DBOpenCond struct {
|
|||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||||
Cond map[string]int32 `protobuf:"bytes,3,rep,name=cond,proto3" json:"cond" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 功能开启条件 key opencond配置id value:0 自动激活 1 已经激活
|
Cond map[string]int32 `protobuf:"bytes,3,rep,name=cond,proto3" json:"cond" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 功能开启条件 key opencond配置id value:0 自动激活 1 已经激活
|
||||||
|
Lv int32 `protobuf:"varint,4,opt,name=lv,proto3" json:"lv"`
|
||||||
|
Friend int32 `protobuf:"varint,5,opt,name=friend,proto3" json:"friend"`
|
||||||
|
Mline map[int32]int32 `protobuf:"bytes,6,rep,name=mline,proto3" json:"mline" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 主线
|
||||||
|
Wtask map[int32]int32 `protobuf:"bytes,7,rep,name=wtask,proto3" json:"wtask" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 任务进度
|
||||||
|
Pagoda map[int32]int32 `protobuf:"bytes,8,rep,name=pagoda,proto3" json:"pagoda" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //
|
||||||
|
Sociaty int32 `protobuf:"varint,9,opt,name=sociaty,proto3" json:"sociaty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBOpenCond) Reset() {
|
func (x *DBOpenCond) Reset() {
|
||||||
@ -83,21 +89,87 @@ func (x *DBOpenCond) GetCond() map[string]int32 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DBOpenCond) GetLv() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Lv
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBOpenCond) GetFriend() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Friend
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBOpenCond) GetMline() map[int32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Mline
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBOpenCond) GetWtask() map[int32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Wtask
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBOpenCond) GetPagoda() map[int32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Pagoda
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBOpenCond) GetSociaty() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Sociaty
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_sys_sys_db_proto protoreflect.FileDescriptor
|
var File_sys_sys_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_sys_sys_db_proto_rawDesc = []byte{
|
var file_sys_sys_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x10, 0x73, 0x79, 0x73, 0x2f, 0x73, 0x79, 0x73, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f,
|
0x0a, 0x10, 0x73, 0x79, 0x73, 0x2f, 0x73, 0x79, 0x73, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
0x74, 0x6f, 0x22, 0x92, 0x01, 0x0a, 0x0a, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e,
|
0x74, 0x6f, 0x22, 0x90, 0x04, 0x0a, 0x0a, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e,
|
||||||
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
|
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
|
||||||
0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||||
0x75, 0x69, 0x64, 0x12, 0x29, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28,
|
0x75, 0x69, 0x64, 0x12, 0x29, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28,
|
||||||
0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x2e, 0x43,
|
0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x2e, 0x43,
|
||||||
0x6f, 0x6e, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x1a, 0x37,
|
0x6f, 0x6e, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x0e,
|
||||||
0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
0x0a, 0x02, 0x6c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x16,
|
||||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
|
0x0a, 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
|
||||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61,
|
0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x2c, 0x0a, 0x05, 0x6d, 0x6c, 0x69, 0x6e, 0x65, 0x18,
|
||||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x64, 0x2e, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6d,
|
||||||
|
0x6c, 0x69, 0x6e, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x07, 0x20,
|
||||||
|
0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x64,
|
||||||
|
0x2e, 0x57, 0x74, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x77, 0x74, 0x61,
|
||||||
|
0x73, 0x6b, 0x12, 0x2f, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x18, 0x08, 0x20, 0x03,
|
||||||
|
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x2e,
|
||||||
|
0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x61, 0x67,
|
||||||
|
0x6f, 0x64, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x18, 0x09,
|
||||||
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x1a, 0x37, 0x0a,
|
||||||
|
0x09, 0x43, 0x6f, 0x6e, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
||||||
|
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
|
||||||
|
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c,
|
||||||
|
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 0x45,
|
||||||
|
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
|
||||||
|
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
|
||||||
|
0x1a, 0x38, 0x0a, 0x0a, 0x57, 0x74, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
|
||||||
|
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79,
|
||||||
|
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
|
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61,
|
||||||
|
0x67, 0x6f, 0x64, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
|
||||||
|
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||||
|
0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -112,18 +184,24 @@ func file_sys_sys_db_proto_rawDescGZIP() []byte {
|
|||||||
return file_sys_sys_db_proto_rawDescData
|
return file_sys_sys_db_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_sys_sys_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
var file_sys_sys_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
var file_sys_sys_db_proto_goTypes = []interface{}{
|
var file_sys_sys_db_proto_goTypes = []interface{}{
|
||||||
(*DBOpenCond)(nil), // 0: DBOpenCond
|
(*DBOpenCond)(nil), // 0: DBOpenCond
|
||||||
nil, // 1: DBOpenCond.CondEntry
|
nil, // 1: DBOpenCond.CondEntry
|
||||||
|
nil, // 2: DBOpenCond.MlineEntry
|
||||||
|
nil, // 3: DBOpenCond.WtaskEntry
|
||||||
|
nil, // 4: DBOpenCond.PagodaEntry
|
||||||
}
|
}
|
||||||
var file_sys_sys_db_proto_depIdxs = []int32{
|
var file_sys_sys_db_proto_depIdxs = []int32{
|
||||||
1, // 0: DBOpenCond.cond:type_name -> DBOpenCond.CondEntry
|
1, // 0: DBOpenCond.cond:type_name -> DBOpenCond.CondEntry
|
||||||
1, // [1:1] is the sub-list for method output_type
|
2, // 1: DBOpenCond.mline:type_name -> DBOpenCond.MlineEntry
|
||||||
1, // [1:1] is the sub-list for method input_type
|
3, // 2: DBOpenCond.wtask:type_name -> DBOpenCond.WtaskEntry
|
||||||
1, // [1:1] is the sub-list for extension type_name
|
4, // 3: DBOpenCond.pagoda:type_name -> DBOpenCond.PagodaEntry
|
||||||
1, // [1:1] is the sub-list for extension extendee
|
4, // [4:4] is the sub-list for method output_type
|
||||||
0, // [0:1] is the sub-list for field type_name
|
4, // [4:4] is the sub-list for method input_type
|
||||||
|
4, // [4:4] is the sub-list for extension type_name
|
||||||
|
4, // [4:4] is the sub-list for extension extendee
|
||||||
|
0, // [0:4] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_sys_sys_db_proto_init() }
|
func init() { file_sys_sys_db_proto_init() }
|
||||||
@ -151,7 +229,7 @@ func file_sys_sys_db_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_sys_sys_db_proto_rawDesc,
|
RawDescriptor: file_sys_sys_db_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 5,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user