开启通知接口

This commit is contained in:
meixiongfeng 2023-09-07 18:57:53 +08:00
parent 1359923623
commit 02f60eb381
6 changed files with 30 additions and 10 deletions

View File

@ -1060,3 +1060,13 @@ const (
Caddtime string = "caddtime" Caddtime string = "caddtime"
Csubtime string = "csubtime" Csubtime string = "csubtime"
) )
// 条件开启枚举
type OpencondType int32
const (
OpencondTypePlatlv OpencondType = 1
OpencondTypeMaxmapid OpencondType = 2
OpencondTypeWorldtaskid OpencondType = 3
OpencondTypeFriend OpencondType = 4
)

View File

@ -42,7 +42,7 @@ type (
type ( type (
ISys interface { ISys interface {
ValidCond(uid string, conf *cfg.GameOpencondData) string ValidCond(uid string, conf *cfg.GameOpencondData) string
CheckLvUpCond(session IUserSession, lv int32) CheckOpenCond(session IUserSession, itype OpencondType, value int32)
// 查询opencond 配置 // 查询opencond 配置
CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData) CheckOpenCondCfgById(uid string, id string) (bOpen bool, errdata *pb.ErrorData)

View File

@ -219,7 +219,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
module, err2 := this.module.service.GetModule(comm.ModuleSys) module, err2 := this.module.service.GetModule(comm.ModuleSys)
if err2 == nil { if err2 == nil {
if isys, ok := module.(comm.ISys); ok { if isys, ok := module.(comm.ISys); ok {
isys.CheckLvUpCond(session, req.StageId) // 校验新功能是否开启 isys.CheckOpenCond(session, comm.OpencondTypeMaxmapid, req.StageId) // 校验新功能是否开启
} }
} }
// 主线任务统计 Rtype60 // 主线任务统计 Rtype60

View File

@ -67,18 +67,26 @@ func (this *configureComp) LoadCondConfig() {
} }
func (this *configureComp) GetOpencondLv(lv int32) []string { func (this *configureComp) GetOpencondLv(lv int32) []string {
this.hlock.RLock()
defer this.hlock.RUnlock()
return this.maplv[lv] return this.maplv[lv]
} }
func (this *configureComp) getOpencondMline(id int32) []string { func (this *configureComp) getOpencondMline(id int32) []string {
this.hlock.RLock()
defer this.hlock.RUnlock()
return this.mapmline[id] return this.mapmline[id]
} }
func (this *configureComp) getOpencondTask(id int32) []string { func (this *configureComp) getOpencondTask(id int32) []string {
this.hlock.RLock()
defer this.hlock.RUnlock()
return this.maptask[id] return this.maptask[id]
} }
func (this *configureComp) getFriendTask(id int32) []string { func (this *configureComp) getFriendTask(id int32) []string {
this.hlock.RLock()
defer this.hlock.RUnlock()
return this.mapfriend[id] return this.mapfriend[id]
} }
func (this *configureComp) getOpencondCfg() (data *cfg.GameOpencond, err error) { func (this *configureComp) getOpencondCfg() (data *cfg.GameOpencond, err error) {

View File

@ -19,10 +19,8 @@ type ModuleSys struct {
service base.IRPCXService service base.IRPCXService
modelSys *ModelSys modelSys *ModelSys
mainline comm.IMainline mainline comm.IMainline
pagoda comm.IPagoda
pagoda comm.IPagoda sociaty comm.ISociaty
sociaty comm.ISociaty
} }
func NewModule() core.IModule { func NewModule() core.IModule {
@ -80,9 +78,13 @@ func (this *ModuleSys) ValidCond(uid string, conf *cfg.GameOpencondData) string
return this.modelSys.validCond(uid, conf) return this.modelSys.validCond(uid, conf)
} }
func (this *ModuleSys) CheckLvUpCond(session comm.IUserSession, lv int32) { func (this *ModuleSys) CheckOpenCond(session comm.IUserSession, itype comm.OpencondType, value int32) {
if cond := this.configure.GetOpencondLv(lv); len(cond) > 0 { switch itype {
this.AutoActivate(session, cond) case comm.OpencondTypePlatlv:
case comm.OpencondTypeMaxmapid:
case comm.OpencondTypeWorldtaskid:
case comm.OpencondTypeFriend:
} }
} }

View File

@ -310,7 +310,7 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{
} }
et.TriggerEvent(comm.EventOpenCond, ul.session.GetUserId(), funcList) 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, if err := ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,