1
This commit is contained in:
parent
90ef5607fb
commit
cfdf663d3d
7
server/statserver/api/ca/enter.go
Normal file
7
server/statserver/api/ca/enter.go
Normal file
@ -0,0 +1,7 @@
|
||||
package ca
|
||||
|
||||
type ApiGroup struct {
|
||||
StatApi
|
||||
}
|
||||
|
||||
var ApiGroupApp = new(ApiGroup)
|
@ -1,15 +1,15 @@
|
||||
package controller
|
||||
package ca
|
||||
|
||||
import (
|
||||
. "main/global"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Stat struct {
|
||||
type StatApi struct {
|
||||
|
||||
}
|
||||
|
||||
func (this *Stat) caUpdateSession(c *gin.Context) {
|
||||
func (this *StatApi) UpdateSession(c *gin.Context) {
|
||||
accountId := c.DefaultQuery("account_id", "")
|
||||
sessionId := c.DefaultQuery("session_id", "")
|
||||
GetSessionMgr().UpdateSession(accountId, sessionId);
|
||||
@ -23,7 +23,7 @@ func (this *Stat) caUpdateSession(c *gin.Context) {
|
||||
c.JSON(200, rspObj)
|
||||
}
|
||||
|
||||
func (this *Stat) caGetonlineNum(c *gin.Context) {
|
||||
func (this *StatApi) GetOnlineNum(c *gin.Context) {
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
@ -1,5 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
|
||||
)
|
@ -11,3 +11,7 @@ type SessionMgr interface {
|
||||
UpdateSession(accountId string, sessionId string)
|
||||
GetOnlineNum() int64
|
||||
}
|
||||
|
||||
type RouterMgr interface {
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package constant
|
||||
|
||||
const (
|
||||
APP_MODULE_IDX = iota
|
||||
CONTROLLER_MGR_MODULE_IDX
|
||||
ROUTER_MGR_MODULE_IDX
|
||||
SESSION_MGR_MODULE_IDX
|
||||
MAX_MODULE_IDX
|
||||
)
|
||||
|
@ -9,16 +9,22 @@ import (
|
||||
|
||||
var modules [constant.MAX_MODULE_IDX]q5.Module
|
||||
var initOrders = []int32{
|
||||
constant.ROUTER_MGR_MODULE_IDX,
|
||||
constant.SESSION_MGR_MODULE_IDX,
|
||||
}
|
||||
|
||||
var app common.App
|
||||
var routerMgr common.RouterMgr
|
||||
var sessionMgr common.SessionMgr
|
||||
|
||||
func GetApp() common.App {
|
||||
return app
|
||||
}
|
||||
|
||||
func GetRouterMgr() common.RouterMgr {
|
||||
return routerMgr
|
||||
}
|
||||
|
||||
func GetSessionMgr() common.SessionMgr {
|
||||
return sessionMgr
|
||||
}
|
||||
@ -31,6 +37,10 @@ func RegModule(idx int32, m q5.Module) {
|
||||
{
|
||||
app = m.(common.App)
|
||||
}
|
||||
case constant.ROUTER_MGR_MODULE_IDX:
|
||||
{
|
||||
routerMgr = m.(common.RouterMgr)
|
||||
}
|
||||
case constant.SESSION_MGR_MODULE_IDX:
|
||||
{
|
||||
sessionMgr = m.(common.SessionMgr)
|
||||
|
5
server/statserver/router/ca/enter.go
Normal file
5
server/statserver/router/ca/enter.go
Normal file
@ -0,0 +1,5 @@
|
||||
package ca
|
||||
|
||||
type RouterGroup struct {
|
||||
StatRouter
|
||||
}
|
13
server/statserver/router/ca/stat.go
Normal file
13
server/statserver/router/ca/stat.go
Normal file
@ -0,0 +1,13 @@
|
||||
package ca
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/api/ca"
|
||||
)
|
||||
|
||||
type StatRouter struct{}
|
||||
|
||||
func (this *StatRouter) InitStatRouter() {
|
||||
f5.GetApp().RegisterCaHandle("Stat", "updateSession", ca.ApiGroupApp.UpdateSession)
|
||||
f5.GetApp().RegisterCaHandle("Ops", "getOnlineNum", ca.ApiGroupApp.GetOnlineNum)
|
||||
}
|
12
server/statserver/router/export.go
Normal file
12
server/statserver/router/export.go
Normal file
@ -0,0 +1,12 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"main/constant"
|
||||
"main/global"
|
||||
)
|
||||
|
||||
var _routerMgr = new(routerMgr)
|
||||
|
||||
func init() {
|
||||
global.RegModule(constant.ROUTER_MGR_MODULE_IDX, _routerMgr)
|
||||
}
|
23
server/statserver/router/routermgr.go
Normal file
23
server/statserver/router/routermgr.go
Normal file
@ -0,0 +1,23 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/router/ca"
|
||||
)
|
||||
|
||||
type routerMgr struct {
|
||||
ca ca.RouterGroup
|
||||
}
|
||||
|
||||
func (this *routerMgr) Init() {
|
||||
/*
|
||||
f5.GetApp().GetGinEngine().Use(middleware.Cors())
|
||||
*/
|
||||
this.ca.InitGameLogRouter()
|
||||
f5.GetSysLog().Info("routerMgr.init")
|
||||
|
||||
}
|
||||
|
||||
func (this *routerMgr) UnInit() {
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user