优化GM服务器
This commit is contained in:
1 parent
00d32292ad
commit
bea91fbf73
12 files changed
+152
-37
No files matched your search
@@ -122,3 +122,15 @@ func (c *Controller) serverDispatchCancel(ctx *gin.Context) {
|
||||
}
|
||||
ctx.JSON(http.StatusOK, &CommonRsp{Code: 0, Msg: "", Data: nil})
|
||||
}
|
||||
|
||||
type ServerOnlineStats struct {
|
||||
TotalOnlinePlayerNum uint32 `json:"total_online_player_num"`
|
||||
}
|
||||
|
||||
func (c *Controller) serverOnlineStats(ctx *gin.Context) {
|
||||
num := 0
|
||||
c.globalGsOnlineMapLock.RLock()
|
||||
num = len(c.globalGsOnlineMap)
|
||||
c.globalGsOnlineMapLock.RUnlock()
|
||||
ctx.JSON(http.StatusOK, &CommonRsp{Code: 0, Msg: "", Data: &ServerOnlineStats{TotalOnlinePlayerNum: uint32(num)}})
|
||||
}
|
||||
Reference in new issue
Block a user