From b46a50bcbf99f57dc933f7abb57c0cf48b778a8a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 20 Jan 2021 11:16:55 +0800 Subject: [PATCH] 1 --- server/analyseapi/gameconf.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/server/analyseapi/gameconf.go b/server/analyseapi/gameconf.go index 993fb5f..e08da22 100644 --- a/server/analyseapi/gameconf.go +++ b/server/analyseapi/gameconf.go @@ -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()