diff --git a/server/gamesapi/middleware/caforward.go b/server/gamesapi/middleware/caforward.go index 29b7e554..ed3fd6cd 100644 --- a/server/gamesapi/middleware/caforward.go +++ b/server/gamesapi/middleware/caforward.go @@ -5,6 +5,7 @@ import ( "mt" "net/http" "q5" + "main/service" "jccommon" "io/ioutil" "bytes" @@ -21,9 +22,16 @@ func CaForward(c *gin.Context) { if !jccommon.IsValidSessionId(accountId, sessionId) { f5.RspErr(c, 500, "invalid session_id") c.Abort() + service.SApiForward.IncInvalidSessionTimes() return } + service.SApiForward.IncTotalTimes() + beginTick := q5.GetTickCount() + defer func() { + costTime := q5.GetTickCount() - beginTick + service.SApiForward.UpdateCostTime(costTime) + }() newUrl := mt.Table.Config.GetById(0).GetRedirectUrl() + c.Request.URL.Path[5:] if !q5.StrContains(newUrl, "?") { newUrl = newUrl + "?" diff --git a/server/gamesapi/service/export.go b/server/gamesapi/service/export.go index 405e578e..bbfe94fe 100644 --- a/server/gamesapi/service/export.go +++ b/server/gamesapi/service/export.go @@ -6,6 +6,7 @@ import ( ) var _serviceMgr = new(serviceMgr) +var SApiForward *sApiForward func init() { global.RegModule(constant.SERVICE_MGR_MODULE_IDX, _serviceMgr) diff --git a/server/gamesapi/service/sapi_forward.go b/server/gamesapi/service/sapi_forward.go new file mode 100644 index 00000000..d90737b4 --- /dev/null +++ b/server/gamesapi/service/sapi_forward.go @@ -0,0 +1,37 @@ +package service + +type sApiForward struct { + +} + +func (this *sApiForward) IncInvalidSessionTimes() { + +} + +func (this *sApiForward) IncTotalTimes() { + +} + +func (this *sApiForward) IncGetTimes() { + +} + +func (this *sApiForward) IncPostTimes() { + +} + +func (this *sApiForward) IncCreateErrTimes() { + +} + +func (this *sApiForward) IncDoErrTimes() { + +} + +func (this *sApiForward) IncReadRspErrTimes() { + +} + +func (this *sApiForward) UpdateCostTime(costTime int64) { + +} diff --git a/server/gamesapi/service/servicemgr.go b/server/gamesapi/service/servicemgr.go index b7128169..755ebe7b 100644 --- a/server/gamesapi/service/servicemgr.go +++ b/server/gamesapi/service/servicemgr.go @@ -5,6 +5,7 @@ type serviceMgr struct { func (this *serviceMgr) Init() { +} func (this *serviceMgr) UnInit() {