This commit is contained in:
aozhiwei 2020-11-13 13:29:05 +08:00
parent 477f18502a
commit 7d6687bb91

View File

@ -27,7 +27,7 @@ type RiskMgr struct {
totalSessionErrBlockTimes int64
sessionErrBlockTimes int64
gameHash map[int32]*GameConf
gameHash map[int64]*GameConf
gameHashMutex sync.RWMutex
clusterConf *MtwServerInfo
@ -40,7 +40,7 @@ func (this* RiskMgr) Init() *RiskMgr {
defer this.gameHashMutex.Unlock()
this.fixedBlockProvinceCityHash = make(map[string]int32)
this.gameHash = make(map[int32]*GameConf)
this.gameHash = make(map[int64]*GameConf)
for _, val := range G.MetaMgr.GetFixedBlockProvinceCity().GetList() {
this.fixedBlockProvinceCityHash[val] = 1
}
@ -122,12 +122,21 @@ func (this* RiskMgr) GetSdkInfo(accessKeyId* string, accessSecret* string) {
*accessSecret = "" + this.accessSecret
}
func (this *RiskMgr) GetGameConf(gameId int32, channel int32) *GameConf {
return nil
func (this *RiskMgr) ForceGameConf(gameId int32, channel int32) *GameConf {
this.gameHashMutex.Lock()
defer this.gameHashMutex.Unlock()
if val, ok := this.gameHash[q5.MkInt64(gameId, channel)]; ok {
return val
} else {
return nil
}
}
func (this *RiskMgr) GetGameConfEx(gameId int32, channel int32) *GameConf {
return nil
func (this *RiskMgr) GetGameConf(gameId int32, channel int32) *GameConf {
this.gameHashMutex.Lock()
defer this.gameHashMutex.Unlock()
val, _ := this.gameHash[q5.MkInt64(gameId, channel)]
return val
}
func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
@ -149,7 +158,7 @@ func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
gameId := f5.ExtractGameIdFromAccountId(accountId)
channel := f5.ExtractChannelFromAccountId(accountId)
gameConf = this.GetGameConf(gameId, channel)
gameConf = this.ForceGameConf(gameId, channel)
if gameConf == nil {
return false
}