feat: 迁移渠道画像累计指标和玩家付费分层

This commit is contained in:
Yvan
2026-11-03 23:50:05 +08:00
parent 0de822f121
commit f5b7ce21b9
38 changed files with 1424 additions and 37 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ func NewGinEngine(runtime *config.Store, access *systemservice.AccessControlServ
func emptyHandlers() *handler.Set {
return &handler.Set{
ChannelPortrait: &handler.ChannelPortrait{},
BusinessPortrait: &handler.BusinessPortrait{},
Channel: &handler.Channel{},
Activation: &handler.Activation{},
@@ -104,7 +105,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":235`) {
if !strings.Contains(text, `"msg":"router register success"`) || !strings.Contains(text, `"route_count":236`) {
t.Fatalf("startup route summary is missing: %s", text)
}
}
@@ -0,0 +1,29 @@
package handler
import (
"github.com/gin-gonic/gin"
"github.com/go-kratos/kratos/v3/errors"
"kra/internal/service/business"
"kra/internal/service/dto"
)
type ChannelPortrait struct {
service *business.ChannelPortraitService
}
func NewChannelPortrait(service *business.ChannelPortraitService) *ChannelPortrait {
return &ChannelPortrait{service: service}
}
func (h *ChannelPortrait) Portrait(c *gin.Context) {
var req dto.ChannelPortraitQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "渠道画像查询参数不正确")
return
}
result, err := h.service.Portrait(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, result)
}
+1
View File
@@ -13,6 +13,7 @@ var ProviderSet = wire.NewSet(
NewActivation,
NewChannel,
NewBusinessPortrait,
NewChannelPortrait,
NewAuthority, NewMenu, NewAPI, NewPermission, NewOrganization,
NewAnnouncement, NewEmail, NewPayment, NewTask, NewMedia, NewAudit,
NewExport, NewVersion, NewDictionary, NewParameter, NewAPIToken,
+1
View File
@@ -1,6 +1,7 @@
package handler
type Set struct {
ChannelPortrait *ChannelPortrait
BusinessPortrait *BusinessPortrait
Channel *Channel
Activation *Activation
+1
View File
@@ -20,6 +20,7 @@ func (r *Routes) RegisterRoutes(public, private *gin.RouterGroup, engine *gin.En
return
}
registrations := []func(){
func() { private.GET("/sw/promote/portrait", r.handlers.ChannelPortrait.Portrait) },
func() {
private.GET("/sw/business/:userId/portrait", r.handlers.BusinessPortrait.ForUser)
private.GET("/sw/business/bindPlatform/portrait", r.handlers.BusinessPortrait.ForBinding)