diff --git a/comm/const.go b/comm/const.go index b6b27bb0e..d82925994 100644 --- a/comm/const.go +++ b/comm/const.go @@ -1060,3 +1060,13 @@ const ( Caddtime string = "caddtime" Csubtime string = "csubtime" ) + +// 条件开启枚举 +type OpencondType int32 + +const ( + OpencondTypePlatlv OpencondType = 1 + OpencondTypeMaxmapid OpencondType = 2 + OpencondTypeWorldtaskid OpencondType = 3 + OpencondTypeFriend OpencondType = 4 +) diff --git a/comm/imodule.go b/comm/imodule.go index 08b7913e7..0fb442fc9 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -42,7 +42,7 @@ type ( type ( ISys interface { ValidCond(uid string, conf *cfg.GameOpencondData) string - CheckLvUpCond(session IUserSession, lv int32) + CheckOpenCond(session IUserSession, itype OpencondType, value int32) // 查询opencond 配置 CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData) diff --git a/modules/mline/api_challengeover.go b/modules/mline/api_challengeover.go index 6970d9437..e701721a6 100644 --- a/modules/mline/api_challengeover.go +++ b/modules/mline/api_challengeover.go @@ -219,7 +219,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall module, err2 := this.module.service.GetModule(comm.ModuleSys) if err2 == nil { if isys, ok := module.(comm.ISys); ok { - isys.CheckLvUpCond(session, req.StageId) // 校验新功能是否开启 + isys.CheckOpenCond(session, comm.OpencondTypeMaxmapid, req.StageId) // 校验新功能是否开启 } } // 主线任务统计 Rtype60 diff --git a/modules/sys/config.go b/modules/sys/config.go index 086052cbe..58af91d78 100644 --- a/modules/sys/config.go +++ b/modules/sys/config.go @@ -67,18 +67,26 @@ func (this *configureComp) LoadCondConfig() { } 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) { diff --git a/modules/sys/module.go b/modules/sys/module.go index 9c8679f1d..3491b2377 100644 --- a/modules/sys/module.go +++ b/modules/sys/module.go @@ -19,10 +19,8 @@ type ModuleSys struct { service base.IRPCXService modelSys *ModelSys mainline comm.IMainline - - pagoda comm.IPagoda - - sociaty comm.ISociaty + pagoda comm.IPagoda + sociaty comm.ISociaty } func NewModule() core.IModule { @@ -80,9 +78,13 @@ func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string return this.modelSys.validCond(uid, conf) } -func (this *ModuleSys) CheckLvUpCond(session comm.IUserSession, lv int32) { - if cond := this.configure.GetOpencondLv(lv); len(cond) > 0 { - this.AutoActivate(session, cond) +func (this *ModuleSys) CheckOpenCond(session comm.IUserSession, itype comm.OpencondType, value int32) { + switch itype { + case comm.OpencondTypePlatlv: + + case comm.OpencondTypeMaxmapid: + case comm.OpencondTypeWorldtaskid: + case comm.OpencondTypeFriend: } } diff --git a/modules/user/model_user.go b/modules/user/model_user.go index 1400ce415..eab8425e8 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -310,7 +310,7 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{ } et.TriggerEvent(comm.EventOpenCond, ul.session.GetUserId(), funcList) - isys.CheckLvUpCond(ul.session, curLv) // 校验新功能是否开启 + isys.CheckOpenCond(ul.session, comm.OpencondTypePlatlv, curLv) // 校验新功能是否开启 } } if err := ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,