feat: 迁移区服分析与游戏区服查询
This commit is contained in:
@@ -27,6 +27,7 @@ func NewGinEngine(runtime *config.Store, access *systemservice.AccessControlServ
|
||||
func emptyHandlers() *handler.Set {
|
||||
return &handler.Set{
|
||||
Analytics: &handler.Analytics{},
|
||||
ServerAnalysis: &handler.ServerAnalysis{},
|
||||
Ledger: &handler.Ledger{},
|
||||
ChannelPortrait: &handler.ChannelPortrait{},
|
||||
BusinessPortrait: &handler.BusinessPortrait{},
|
||||
@@ -107,7 +108,7 @@ func TestGinStartupLogsEveryRegisteredRoute(t *testing.T) {
|
||||
if got, want := strings.Count(text, `"msg":"router registered"`), len(engine.Routes()); got != want {
|
||||
t.Fatalf("registered route log count = %d, want %d", got, want)
|
||||
}
|
||||
if !strings.Contains(text, `"msg":"router register success"`) || !strings.Contains(text, `"route_count":243`) {
|
||||
if !strings.Contains(text, `"msg":"router register success"`) || !strings.Contains(text, `"route_count":245`) {
|
||||
t.Fatalf("startup route summary is missing: %s", text)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ var ProviderSet = wire.NewSet(
|
||||
NewChannelPortrait,
|
||||
NewLedger,
|
||||
NewAnalytics,
|
||||
NewServerAnalysis,
|
||||
NewAuthority, NewMenu, NewAPI, NewPermission, NewOrganization,
|
||||
NewAnnouncement, NewEmail, NewPayment, NewTask, NewMedia, NewAudit,
|
||||
NewExport, NewVersion, NewDictionary, NewParameter, NewAPIToken,
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
"kra/internal/service/business"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type ServerAnalysis struct {
|
||||
service *business.ServerAnalysisService
|
||||
}
|
||||
|
||||
func NewServerAnalysis(service *business.ServerAnalysisService) *ServerAnalysis {
|
||||
return &ServerAnalysis{service: service}
|
||||
}
|
||||
func (h *ServerAnalysis) List(c *gin.Context) {
|
||||
var req dto.ServerAnalysisQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "区服查询参数不正确")
|
||||
return
|
||||
}
|
||||
data, err := h.service.List(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, data)
|
||||
}
|
||||
func (h *ServerAnalysis) Servers(c *gin.Context) {
|
||||
var req dto.ServerOptionQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "区服查询参数不正确")
|
||||
return
|
||||
}
|
||||
data, err := h.service.Servers(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, data)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package handler
|
||||
|
||||
type Set struct {
|
||||
ServerAnalysis *ServerAnalysis
|
||||
Analytics *Analytics
|
||||
Ledger *Ledger
|
||||
ChannelPortrait *ChannelPortrait
|
||||
|
||||
@@ -20,6 +20,10 @@ func (r *Routes) RegisterRoutes(public, private *gin.RouterGroup, engine *gin.En
|
||||
return
|
||||
}
|
||||
registrations := []func(){
|
||||
func() {
|
||||
private.GET("/sw/serverAnalysis/servers", r.handlers.ServerAnalysis.Servers)
|
||||
private.GET("/sw/serverAnalysis/list", r.handlers.ServerAnalysis.List)
|
||||
},
|
||||
func() {
|
||||
private.GET("/sw/channelData/list", r.handlers.Analytics.Channels)
|
||||
private.GET("/sw/gameData/list", r.handlers.Analytics.Games)
|
||||
|
||||
Reference in New Issue
Block a user