This commit is contained in:
aozhiwei 2021-01-20 11:16:55 +08:00
parent 4b78cf4bd1
commit b46a50bcbf

View File

@ -26,13 +26,12 @@ type GameConf struct {
blockTimes int64
totalLaunchWhiteListPassTimes int64
launchWhiteListPassTimes int64
totalSafeZonePassTimes int64
safeZonePassTimes int64
totalDataBlockTimes int64
totalLaunchWhiteListBlockTimes int64
sceneWhiteListBlockTimes int64
launchWhiteListBlockTimes int64
totalUnSafeZoneBlockTimes int64
unSafeZoneBlockTimes int64
}
@ -53,8 +52,8 @@ func (this *GameConf) IsPass(remoteAddr string, launchInfo string, responseStr*
return true
} else {
if this.InLaunchWhiteList(launchObj) {
atomic.AddInt64(&this.totalLaunchWhiteListBlockTimes, 1)
atomic.AddInt64(&this.launchWhiteListBlockTimes, 1)
atomic.AddInt64(&this.totalLaunchWhiteListPassTimes, 1)
atomic.AddInt64(&this.launchWhiteListPassTimes, 1)
return true
} else {
atomic.AddInt64(&this.totalUnSafeZoneBlockTimes, 1)
@ -78,6 +77,7 @@ func (this* GameConf) InSceneWhiteList(launchObj *q5.XObject) bool {
return ok
}
func (this* GameConf) InLaunchWhiteList(launchObj *q5.XObject) bool {
this.launchWhiteListMutex.Lock()
defer this.launchWhiteListMutex.Unlock()
@ -139,7 +139,10 @@ func (this* GameConf) GetConfObj() *q5.XObject {
func (this* GameConf) GetPassObj() *q5.XObject {
passObj := q5.NewMxoObject()
passObj.SetXValue("total", q5.NewXInt64(this.totalPassTimes))
passObj.SetXValue("curr", q5.NewXInt64(this.passTimes))
passObj.SetXValue("total_white_launch_times", q5.NewXInt64(this.totalLaunchWhiteListPassTimes))
passObj.SetXValue("curr_white_launch_times", q5.NewXInt64(this.launchWhiteListPassTimes))
passObj.SetXValue("total_safezone_times", q5.NewXInt64(this.totalSafeZonePassTimes))
passObj.SetXValue("curr_safezone_times", q5.NewXInt64(this.safeZonePassTimes))
return passObj.AsXObject()
@ -147,10 +150,10 @@ func (this* GameConf) GetPassObj() *q5.XObject {
func (this* GameConf) GetBlockObj() *q5.XObject {
blockObj := q5.NewMxoObject()
blockObj.SetXValue("total", q5.NewXInt64(this.totalBlockTimes))
blockObj.SetXValue("curr", q5.NewXInt64(this.blockTimes))
blockObj.SetXValue("total_data_times", q5.NewXInt64(this.totalDataBlockTimes))
blockObj.SetXValue("total_white_launch_times", q5.NewXInt64(this.totalLaunchWhiteListBlockTimes))
blockObj.SetXValue("curr_white_scene_times", q5.NewXInt64(this.sceneWhiteListBlockTimes))
blockObj.SetXValue("curr_white_launch_times", q5.NewXInt64(this.launchWhiteListBlockTimes))
blockObj.SetXValue("total_unsafezone_times", q5.NewXInt64(this.totalUnSafeZoneBlockTimes))
blockObj.SetXValue("curr_unsafezone_times", q5.NewXInt64(this.unSafeZoneBlockTimes))
return blockObj.AsXObject()
@ -162,7 +165,7 @@ func (this* GameConf) Active() {
atomic.StoreInt64(&this.blockTimes, 0)
atomic.StoreInt64(&this.sceneWhiteListBlockTimes, 0)
atomic.StoreInt64(&this.safeZonePassTimes, 0)
atomic.StoreInt64(&this.launchWhiteListBlockTimes, 0)
atomic.StoreInt64(&this.launchWhiteListPassTimes, 0)
atomic.StoreInt64(&this.unSafeZoneBlockTimes, 0)
}
this.lastActiveTime = f5.App.NowUnix()