feat: 迁移渠道列表新增和游戏累计分布

This commit is contained in:
Yvan
2026-11-03 21:32:51 +08:00
parent 5e58c6bcf3
commit 075d94a51e
39 changed files with 2216 additions and 12 deletions
+61
View File
@@ -0,0 +1,61 @@
package handler
import (
"github.com/gin-gonic/gin"
"github.com/go-kratos/kratos/v3/errors"
"kra/internal/service/business"
"kra/internal/service/dto"
"net/http"
)
type Channel struct{ service *business.ChannelService }
func NewChannel(service *business.ChannelService) *Channel { return &Channel{service: service} }
func (h *Channel) List(c *gin.Context) {
var req dto.ChannelQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "渠道查询参数不正确")
return
}
result, err := h.service.List(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, result)
}
func (h *Channel) Bindings(c *gin.Context) {
result, err := h.service.BindOptions(c.Request.Context(), c.Query("sourceDb"))
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, result)
}
func (h *Channel) Create(c *gin.Context) {
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, 1<<20)
var req dto.ChannelCreateRequest
if c.ShouldBindJSON(&req) != nil {
Fail(c, "渠道参数不正确")
return
}
result, err := h.service.Create(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
Write(c, CodeSuccess, result, "添加成功,数据同步到列表可能有延迟")
}
func (h *Channel) Games(c *gin.Context) {
var req dto.ChannelGameQuery
if c.ShouldBindQuery(&req) != nil {
Fail(c, "渠道查询参数不正确")
return
}
result, err := h.service.Games(c.Request.Context(), &req)
if err != nil {
Fail(c, errors.FromError(err).Message)
return
}
OKWithData(c, result)
}
+1
View File
@@ -11,6 +11,7 @@ var ProviderSet = wire.NewSet(
NewAlertRule,
NewAlertRecord,
NewActivation,
NewChannel,
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 {
Channel *Channel
Activation *Activation
AlertRecord *AlertRecord
AlertRule *AlertRule