package handler import ( "strconv" "github.com/gin-gonic/gin" "github.com/go-kratos/kratos/v3/errors" "kra/internal/service/business" "kra/internal/service/dto" ) type Activation struct{ service *business.ActivationService } func NewActivation(service *business.ActivationService) *Activation { return &Activation{service: service} } func (h *Activation) List(c *gin.Context) { var req dto.ActivationQuery 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 *Activation) SpendDetail(c *gin.Context) { id, err := strconv.ParseUint(c.Query("id"), 10, 64) if err != nil { Fail(c, "绑定记录不存在") return } result, err := h.service.SpendDetail(c.Request.Context(), id) if err != nil { Fail(c, errors.FromError(err).Message) return } OKWithData(c, result) }