30 lines
704 B
Go
30 lines
704 B
Go
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)
|
|
}
|