feat: 迁移渠道商务游戏排行榜及同期比较
This commit is contained in:
@@ -29,6 +29,7 @@ func emptyHandlers() *handler.Set {
|
||||
Analytics: &handler.Analytics{},
|
||||
ServerAnalysis: &handler.ServerAnalysis{},
|
||||
Workbench: &handler.Workbench{},
|
||||
Ranking: &handler.Ranking{},
|
||||
Ledger: &handler.Ledger{},
|
||||
ChannelPortrait: &handler.ChannelPortrait{},
|
||||
BusinessPortrait: &handler.BusinessPortrait{},
|
||||
@@ -109,7 +110,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":249`) {
|
||||
if !strings.Contains(text, `"msg":"router register success"`) || !strings.Contains(text, `"route_count":252`) {
|
||||
t.Fatalf("startup route summary is missing: %s", text)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ var ProviderSet = wire.NewSet(
|
||||
NewAnalytics,
|
||||
NewServerAnalysis,
|
||||
NewWorkbench,
|
||||
NewRanking,
|
||||
NewAuthority, NewMenu, NewAPI, NewPermission, NewOrganization,
|
||||
NewAnnouncement, NewEmail, NewPayment, NewTask, NewMedia, NewAudit,
|
||||
NewExport, NewVersion, NewDictionary, NewParameter, NewAPIToken,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
businessbiz "kra/internal/biz/business"
|
||||
"kra/internal/service/business"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type Ranking struct{ service *business.RankingService }
|
||||
|
||||
func NewRanking(service *business.RankingService) *Ranking { return &Ranking{service: service} }
|
||||
func (h *Ranking) list(c *gin.Context, kind businessbiz.RankingKind) {
|
||||
var req dto.RankingQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "排行榜查询参数不正确")
|
||||
return
|
||||
}
|
||||
data, err := h.service.List(c.Request.Context(), kind, &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, data)
|
||||
}
|
||||
func (h *Ranking) Channel(c *gin.Context) { h.list(c, businessbiz.ChannelRanking) }
|
||||
func (h *Ranking) Business(c *gin.Context) { h.list(c, businessbiz.BusinessRanking) }
|
||||
func (h *Ranking) Game(c *gin.Context) { h.list(c, businessbiz.GameRanking) }
|
||||
@@ -1,6 +1,7 @@
|
||||
package handler
|
||||
|
||||
type Set struct {
|
||||
Ranking *Ranking
|
||||
Workbench *Workbench
|
||||
ServerAnalysis *ServerAnalysis
|
||||
Analytics *Analytics
|
||||
|
||||
@@ -20,6 +20,11 @@ func (r *Routes) RegisterRoutes(public, private *gin.RouterGroup, engine *gin.En
|
||||
return
|
||||
}
|
||||
registrations := []func(){
|
||||
func() {
|
||||
private.GET("/sw/rank/channel", r.handlers.Ranking.Channel)
|
||||
private.GET("/sw/rank/business", r.handlers.Ranking.Business)
|
||||
private.GET("/sw/rank/game", r.handlers.Ranking.Game)
|
||||
},
|
||||
func() {
|
||||
private.GET("/sw/workbench/summary", r.handlers.Workbench.Summary)
|
||||
private.GET("/sw/workbench/registerTop", r.handlers.Workbench.RegisterTop)
|
||||
|
||||
Reference in New Issue
Block a user