feat: 迁移商务与游戏商务画像及交互看板
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
"kra/internal/service/business"
|
||||
"kra/internal/service/dto"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type BusinessPortrait struct {
|
||||
service *business.BusinessPortraitService
|
||||
}
|
||||
|
||||
func NewBusinessPortrait(service *business.BusinessPortraitService) *BusinessPortrait {
|
||||
return &BusinessPortrait{service: service}
|
||||
}
|
||||
func (h *BusinessPortrait) ForUser(c *gin.Context) {
|
||||
id, err := strconv.ParseUint(c.Param("userId"), 10, 64)
|
||||
if err != nil {
|
||||
Fail(c, "商务用户 ID 不正确")
|
||||
return
|
||||
}
|
||||
var req dto.BusinessPortraitQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "商务画像查询参数不正确")
|
||||
return
|
||||
}
|
||||
result, err := h.service.ForUser(c.Request.Context(), uint(id), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, result)
|
||||
}
|
||||
func (h *BusinessPortrait) ForBinding(c *gin.Context) {
|
||||
var req dto.BindingPortraitQuery
|
||||
if c.ShouldBindQuery(&req) != nil {
|
||||
Fail(c, "商务画像查询参数不正确")
|
||||
return
|
||||
}
|
||||
result, err := h.service.ForBinding(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, result)
|
||||
}
|
||||
@@ -12,6 +12,7 @@ var ProviderSet = wire.NewSet(
|
||||
NewAlertRecord,
|
||||
NewActivation,
|
||||
NewChannel,
|
||||
NewBusinessPortrait,
|
||||
NewAuthority, NewMenu, NewAPI, NewPermission, NewOrganization,
|
||||
NewAnnouncement, NewEmail, NewPayment, NewTask, NewMedia, NewAudit,
|
||||
NewExport, NewVersion, NewDictionary, NewParameter, NewAPIToken,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package handler
|
||||
|
||||
type Set struct {
|
||||
BusinessPortrait *BusinessPortrait
|
||||
Channel *Channel
|
||||
Activation *Activation
|
||||
AlertRecord *AlertRecord
|
||||
|
||||
Reference in New Issue
Block a user