feat: 迁移渠道与游戏统计及全量汇总
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
"kra/internal/service/business"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type Analytics struct{ service *business.AnalyticsService }
|
||||
|
||||
func NewAnalytics(service *business.AnalyticsService) *Analytics { return &Analytics{service: service} }
|
||||
func (h *Analytics) Channels(c *gin.Context) {
|
||||
var req dto.AnalyticsQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "统计查询参数不正确")
|
||||
return
|
||||
}
|
||||
data, err := h.service.Channels(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, data)
|
||||
}
|
||||
func (h *Analytics) Games(c *gin.Context) {
|
||||
var req dto.AnalyticsQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "统计查询参数不正确")
|
||||
return
|
||||
}
|
||||
data, err := h.service.Games(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, data)
|
||||
}
|
||||
Reference in New Issue
Block a user