init
This commit is contained in:
7
src/internal/config/config.go
Normal file
7
src/internal/config/config.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/rest"
|
||||
|
||||
type Config struct {
|
||||
rest.RestConf
|
||||
}
|
||||
29
src/internal/handler/pinghandler.go
Normal file
29
src/internal/handler/pinghandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Ping the server to check if it's alive
|
||||
func pingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.PingReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewPingLogic(r.Context(), svcCtx)
|
||||
resp, err := l.Ping(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/recentjoinplayerhandler.go
Normal file
29
src/internal/handler/recentjoinplayerhandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get recent players who joined within a specified time range
|
||||
func recentJoinPlayerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.RecentJoinPlayerReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewRecentJoinPlayerLogic(r.Context(), svcCtx)
|
||||
resp, err := l.RecentJoinPlayer(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/recentplayerjoinhandler.go
Normal file
29
src/internal/handler/recentplayerjoinhandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get recent player joins within a specified time range
|
||||
func recentPlayerJoinHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalPlayerJoinReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewRecentPlayerJoinLogic(r.Context(), svcCtx)
|
||||
resp, err := l.RecentPlayerJoin(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
74
src/internal/handler/routes.go
Normal file
74
src/internal/handler/routes.go
Normal file
@@ -0,0 +1,74 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.8.4
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"src/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// Ping the server to check if it's alive
|
||||
Method: http.MethodGet,
|
||||
Path: "/ping",
|
||||
Handler: pingHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get recent players who joined within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/recent-join-player",
|
||||
Handler: recentJoinPlayerHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// Get recent player joins within a specified time range
|
||||
Method: http.MethodPost,
|
||||
Path: "/recent-player-join",
|
||||
Handler: recentPlayerJoinHandler(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"),
|
||||
)
|
||||
}
|
||||
29
src/internal/handler/totalchatmessagecounthandler.go
Normal file
29
src/internal/handler/totalchatmessagecounthandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get total chat message count within a specified time range
|
||||
func totalChatMessageCountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalChatMessageCountReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewTotalChatMessageCountLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TotalChatMessageCount(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/totalconnectcounthandler.go
Normal file
29
src/internal/handler/totalconnectcounthandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get total connect count within a specified time range
|
||||
func totalConnectCountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalConnectCountReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewTotalConnectCountLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TotalConnectCount(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/totaldamagecounthandler.go
Normal file
29
src/internal/handler/totaldamagecounthandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get total damage count within a specified time range
|
||||
func totalDamageCountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalDamageCountReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewTotalDamageCountLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TotalDamageCount(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/totalkillcounthandler.go
Normal file
29
src/internal/handler/totalkillcounthandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get total kill count within a specified time range
|
||||
func totalKillCountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalKillCountReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewTotalKillCountLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TotalKillCount(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/totalplayercounthandler.go
Normal file
29
src/internal/handler/totalplayercounthandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get total player count within a specified time range
|
||||
func totalPlayerCountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalPlayerCountReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewTotalPlayerCountLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TotalPlayerCount(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
29
src/internal/handler/totalplaytimehandler.go
Normal file
29
src/internal/handler/totalplaytimehandler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"src/internal/logic"
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
)
|
||||
|
||||
// Get total playtime within a specified time range
|
||||
func totalPlayTimeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TotalPlayTimeReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := logic.NewTotalPlayTimeLogic(r.Context(), svcCtx)
|
||||
resp, err := l.TotalPlayTime(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/internal/logic/pinglogic.go
Normal file
31
src/internal/logic/pinglogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type PingLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Ping the server to check if it's alive
|
||||
func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
||||
return &PingLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *PingLogic) Ping(req *types.PingReq) (resp *types.PingResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/recentjoinplayerlogic.go
Normal file
31
src/internal/logic/recentjoinplayerlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RecentJoinPlayerLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get recent players who joined within a specified time range
|
||||
func NewRecentJoinPlayerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecentJoinPlayerLogic {
|
||||
return &RecentJoinPlayerLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RecentJoinPlayerLogic) RecentJoinPlayer(req *types.RecentJoinPlayerReq) (resp *types.RecentJoinPlayerResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/recentplayerjoinlogic.go
Normal file
31
src/internal/logic/recentplayerjoinlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type RecentPlayerJoinLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get recent player joins within a specified time range
|
||||
func NewRecentPlayerJoinLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RecentPlayerJoinLogic {
|
||||
return &RecentPlayerJoinLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *RecentPlayerJoinLogic) RecentPlayerJoin(req *types.TotalPlayerJoinReq) (resp *types.TotalPlayerJoinResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/totalchatmessagecountlogic.go
Normal file
31
src/internal/logic/totalchatmessagecountlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type TotalChatMessageCountLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get total chat message count within a specified time range
|
||||
func NewTotalChatMessageCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TotalChatMessageCountLogic {
|
||||
return &TotalChatMessageCountLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TotalChatMessageCountLogic) TotalChatMessageCount(req *types.TotalChatMessageCountReq) (resp *types.TotalChatMessageCountResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/totalconnectcountlogic.go
Normal file
31
src/internal/logic/totalconnectcountlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type TotalConnectCountLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get total connect count within a specified time range
|
||||
func NewTotalConnectCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TotalConnectCountLogic {
|
||||
return &TotalConnectCountLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TotalConnectCountLogic) TotalConnectCount(req *types.TotalConnectCountReq) (resp *types.TotalConnectCountResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/totaldamagecountlogic.go
Normal file
31
src/internal/logic/totaldamagecountlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type TotalDamageCountLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get total damage count within a specified time range
|
||||
func NewTotalDamageCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TotalDamageCountLogic {
|
||||
return &TotalDamageCountLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TotalDamageCountLogic) TotalDamageCount(req *types.TotalDamageCountReq) (resp *types.TotalDamageCountResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/totalkillcountlogic.go
Normal file
31
src/internal/logic/totalkillcountlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type TotalKillCountLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get total kill count within a specified time range
|
||||
func NewTotalKillCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TotalKillCountLogic {
|
||||
return &TotalKillCountLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TotalKillCountLogic) TotalKillCount(req *types.TotalKillCountReq) (resp *types.TotalKillCountResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/totalplayercountlogic.go
Normal file
31
src/internal/logic/totalplayercountlogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type TotalPlayerCountLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get total player count within a specified time range
|
||||
func NewTotalPlayerCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TotalPlayerCountLogic {
|
||||
return &TotalPlayerCountLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TotalPlayerCountLogic) TotalPlayerCount(req *types.TotalPlayerCountReq) (resp *types.TotalPlayerCountResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
31
src/internal/logic/totalplaytimelogic.go
Normal file
31
src/internal/logic/totalplaytimelogic.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"src/internal/svc"
|
||||
"src/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type TotalPlayTimeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// Get total playtime within a specified time range
|
||||
func NewTotalPlayTimeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TotalPlayTimeLogic {
|
||||
return &TotalPlayTimeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *TotalPlayTimeLogic) TotalPlayTime(req *types.TotalPlayTimeReq) (resp *types.TotalPlayTimeResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
15
src/internal/svc/servicecontext.go
Normal file
15
src/internal/svc/servicecontext.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"src/internal/config"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
}
|
||||
}
|
||||
112
src/internal/types/types.go
Normal file
112
src/internal/types/types.go
Normal file
@@ -0,0 +1,112 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.8.4
|
||||
|
||||
package types
|
||||
|
||||
type PingReq struct {
|
||||
}
|
||||
|
||||
type PingResp struct {
|
||||
Ok bool `json:"ok"`
|
||||
}
|
||||
|
||||
type RecentChatMessageReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type RecentChatMessageResp struct {
|
||||
Messages []RecentChatMessageRespMessage `json:"messages"` // List of recent chat messages
|
||||
}
|
||||
|
||||
type RecentChatMessageRespMessage struct {
|
||||
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
||||
UserName string `json:"userName"` // Player's username at the time of message
|
||||
Message string `json:"message"` // Chat message content
|
||||
TimeStamp int64 `json:"timeStamp"` // Message timestamp as Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type RecentJoinPlayerReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type RecentJoinPlayerResp struct {
|
||||
Players []RecentJoinPlayerRespPlayer `json:"players"` // List of player SteamID64s who joined in the time range
|
||||
}
|
||||
|
||||
type RecentJoinPlayerRespPlayer struct {
|
||||
SteamID64 string `json:"steamID64"` // Player's SteamID64
|
||||
JoinTime int64 `json:"joinTime"` // Join time as Unix timestamp in milliseconds
|
||||
UserName string `json:"userName"` // Player's username at the time of joining
|
||||
PlayTime int64 `json:"playTime"` // Playtime in seconds since joining
|
||||
}
|
||||
|
||||
type TotalChatMessageCountReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
PlayerFilter []string `json:"playerFilter"` // List of player SteamID64s to filter by (optional)
|
||||
}
|
||||
|
||||
type TotalChatMessageCountResp struct {
|
||||
TotalChatMessageCount int64 `json:"totalChatMessageCount"` // Total chat message count
|
||||
}
|
||||
|
||||
type TotalConnectCountReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type TotalConnectCountResp struct {
|
||||
TotalConnectCount int64 `json:"totalConnectCount"` // Total connect count
|
||||
}
|
||||
|
||||
type TotalDamageCountReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
WeaponFilter []string `json:"weaponFilter"` // List of weapon names to filter by (optional)
|
||||
PlayerFilter []string `json:"playerFilter"` // List of player SteamID64s to filter by (optional)
|
||||
}
|
||||
|
||||
type TotalDamageCountResp struct {
|
||||
TotalDamageCount int64 `json:"totalDamageCount"` // Total damage count
|
||||
}
|
||||
|
||||
type TotalKillCountReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
HeadshotOnly bool `json:"headshotOnly"` // If true, count only headshot kills
|
||||
WeaponFilter []string `json:"weaponFilter"` // List of weapon names to filter by (optional)
|
||||
PlayerFilter []string `json:"playerFilter"` // List of player SteamID64s to filter by (optional)
|
||||
}
|
||||
|
||||
type TotalKillCountResp struct {
|
||||
TotalKillCount int64 `json:"totalKillCount"` // Total kill count
|
||||
}
|
||||
|
||||
type TotalPlayTimeReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type TotalPlayTimeResp struct {
|
||||
TotalPlayTime int64 `json:"totalPlayTime"` // Total playtime in seconds
|
||||
}
|
||||
|
||||
type TotalPlayerCountReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type TotalPlayerCountResp struct {
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
||||
type TotalPlayerJoinReq struct {
|
||||
TimeRangeStart int64 `json:"timeRangeStart"` // Unix timestamp in milliseconds
|
||||
TimeRangeEnd int64 `json:"timeRangeEnd"` // Unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
type TotalPlayerJoinResp struct {
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
Reference in New Issue
Block a user