This commit is contained in:
aozhiwei 2020-11-13 11:44:44 +08:00
parent d43c332e66
commit 477f18502a
2 changed files with 31 additions and 3 deletions

View File

@ -66,9 +66,28 @@ func (this* RiskMgr) Init() *RiskMgr {
func (this* RiskMgr) UnInit() {
}
func (this* RiskMgr) fetchGameConfList() []*GameConf {
this.gameHashMutex.Lock()
defer this.gameHashMutex.Unlock()
gameConfList := []*GameConf{}
for _, val := range this.gameHash {
gameConfList = append(gameConfList, val)
}
return gameConfList
}
func (this* RiskMgr) OutputLog() {
//f5.SysLog().Info("passobj %s", this.GetPassObj().ToJsonStr())
//f5.SysLog().Info("blockobj %s", this.GetBlockObj().ToJsonStr())
for _, val := range this.fetchGameConfList() {
f5.SysLog().Info("gameid:%d channel:%d passobj %s",
val.gameId,
val.channel,
val.GetPassObj().ToJsonStr())
f5.SysLog().Info("gameid:%d channel:%d blockobj %s",
val.gameId,
val.channel,
val.GetBlockObj().ToJsonStr())
}
f5.SysLog().Info("global passobj %s", this.GetGlobalPassObj().ToJsonStr())
f5.SysLog().Info("global blockobj %s", this.GetGlobalBlockObj().ToJsonStr())
atomic.StoreInt64(&this.passTimes, 0)
@ -80,12 +99,19 @@ func (this* RiskMgr) OutputLog() {
func (this* RiskMgr) GetGlobalPassObj() *q5.XObject {
passObj := q5.NewMxoObject()
/// passObj.SetXValue("curr_white_ip_times", q5.NewXInt64(this.ipWhiteListPassTimes))
passObj.SetXValue("total", q5.NewXInt64(this.totalPassTimes))
passObj.SetXValue("curr", q5.NewXInt64(this.passTimes))
return passObj.AsXObject()
}
func (this* RiskMgr) GetGlobalBlockObj() *q5.XObject {
blockObj := q5.NewMxoObject()
blockObj.SetXValue("total", q5.NewXInt64(this.totalBlockTimes))
blockObj.SetXValue("curr", q5.NewXInt64(this.blockTimes))
blockObj.SetXValue("total_methoderr", q5.NewXInt64(this.totalHttpMethodBlockTimes))
blockObj.SetXValue("curr_methoderr", q5.NewXInt64(this.httpMethodBlockTimes))
blockObj.SetXValue("total_sessonerr", q5.NewXInt64(this.totalSessionErrBlockTimes))
blockObj.SetXValue("curr_sessionerr", q5.NewXInt64(this.sessionErrBlockTimes))
return blockObj.AsXObject()
}

View File

@ -8,6 +8,8 @@ import (
)
type GameConf struct {
gameId int32
channel int32
ipWhiteList map[string]int32
ipWhiteListMutex sync.RWMutex