feat: add total player count and total playtime logic
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 1m27s
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 1m27s
- Implemented TotalPlayerCountLogic to retrieve the total number of unique players within a specified time range. - Implemented TotalPlayTimeLogic to calculate the total playtime of players within a specified time range. - Created ServiceContext to manage database connections and initialize necessary tables. - Added types for total player count and total playtime requests and responses. - Set up the main server file to start the application with the necessary configurations. - Updated go.mod and go.sum for new dependencies.
This commit is contained in:
104
app/internal/handler/routes.go
Normal file
104
app/internal/handler/routes.go
Normal file
@@ -0,0 +1,104 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.8.4
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.cialloo.com/CiallooWeb/ServerStatistics/app/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// Get the list of monitored game servers
|
||||
Method: http.MethodGet,
|
||||
Path: "/list",
|
||||
Handler: ServerListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Ping the server to check if it's alive
|
||||
Method: http.MethodGet,
|
||||
Path: "/ping",
|
||||
Handler: pingHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get recent chat messages within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/recent-chat-message",
|
||||
Handler: recentChatMessageHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get recent players who joined within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/recent-join-player",
|
||||
Handler: recentJoinPlayerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get recent players who played within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/recent-play",
|
||||
Handler: recentPlayHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get recent player joins within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/recent-player-join",
|
||||
Handler: recentPlayerJoinHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get top players by kill count within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/top-killer",
|
||||
Handler: topKillerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get top players by playtime within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/top-play-time",
|
||||
Handler: topPlayTimeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get total chat message count within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/total-chat-message-count",
|
||||
Handler: totalChatMessageCountHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get total connect count within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/total-connect-count",
|
||||
Handler: totalConnectCountHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get total damage count within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/total-damage-count",
|
||||
Handler: totalDamageCountHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get total kill count within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/total-kill-count",
|
||||
Handler: totalKillCountHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get total playtime within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/total-play-time",
|
||||
Handler: totalPlayTimeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get total player count within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/total-player-count",
|
||||
Handler: totalPlayerCountHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/server/statistics"),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user