68 lines
2.6 KiB
Go
68 lines
2.6 KiB
Go
package controller
|
|
|
|
import (
|
|
"context"
|
|
"digital-human/digitalhuman/model/dto"
|
|
"digital-human/digitalhuman/service"
|
|
|
|
"gitea.com/red-future/common/beans"
|
|
)
|
|
|
|
type digitalhuman struct{}
|
|
|
|
// DigitalHuman 数字人形象控制器
|
|
var DigitalHuman = new(digitalhuman)
|
|
|
|
// CreateDigitalHuman 创建数字人形象
|
|
func (c *digitalhuman) CreateDigitalHuman(ctx context.Context, req *dto.CreateDigitalHumanReq) (res *dto.CreateDigitalHumanRes, err error) {
|
|
return service.DigitalHuman.Create(ctx, req)
|
|
}
|
|
|
|
// ListDigitalHuman 获取数字人形象列表
|
|
func (c *digitalhuman) ListDigitalHuman(ctx context.Context, req *dto.ListDigitalHumanReq) (res *dto.ListDigitalHumanRes, err error) {
|
|
return service.DigitalHuman.List(ctx, req)
|
|
}
|
|
|
|
// GetDigitalHuman 获取数字人形象详情
|
|
func (c *digitalhuman) GetDigitalHuman(ctx context.Context, req *dto.GetDigitalHumanReq) (res *dto.GetDigitalHumanRes, err error) {
|
|
return service.DigitalHuman.GetOne(ctx, req.ID)
|
|
}
|
|
|
|
// UpdateDigitalHuman 更新数字人形象
|
|
func (c *digitalhuman) UpdateDigitalHuman(ctx context.Context, req *dto.UpdateDigitalHumanReq) (res *beans.ResponseEmpty, err error) {
|
|
err = service.DigitalHuman.Update(ctx, req)
|
|
return
|
|
}
|
|
|
|
// UpdateDigitalHumanStatus 更新数字人形象状态
|
|
func (c *digitalhuman) UpdateDigitalHumanStatus(ctx context.Context, req *dto.UpdateDigitalHumanStatusReq) (res *beans.ResponseEmpty, err error) {
|
|
err = service.DigitalHuman.UpdateStatus(ctx, req.ID, req.Status)
|
|
return
|
|
}
|
|
|
|
// DeleteDigitalHuman 删除数字人形象
|
|
func (c *digitalhuman) DeleteDigitalHuman(ctx context.Context, req *dto.DeleteDigitalHumanReq) (res *beans.ResponseEmpty, err error) {
|
|
err = service.DigitalHuman.Delete(ctx, req.ID)
|
|
return
|
|
}
|
|
|
|
// GetDigitalHumanStatusOptions 获取数字人状态选项
|
|
func (c *digitalhuman) GetDigitalHumanStatusOptions(ctx context.Context, req *dto.GetDigitalHumanStatusOptionsReq) (res *dto.GetDigitalHumanStatusOptionsRes, err error) {
|
|
return service.DigitalHuman.GetStatusOptions(ctx, req)
|
|
}
|
|
|
|
// GetGenderOptions 获取性别选项
|
|
func (c *digitalhuman) GetGenderOptions(ctx context.Context, req *dto.GetGenderOptionsReq) (res *dto.GetGenderOptionsRes, err error) {
|
|
return service.DigitalHuman.GetGenderOptions(ctx, req)
|
|
}
|
|
|
|
// GetAgeOptions 获取年龄段选项
|
|
func (c *digitalhuman) GetAgeOptions(ctx context.Context, req *dto.GetAgeOptionsReq) (res *dto.GetAgeOptionsRes, err error) {
|
|
return service.DigitalHuman.GetAgeOptions(ctx, req)
|
|
}
|
|
|
|
// GetStyleOptions 获取风格选项
|
|
func (c *digitalhuman) GetStyleOptions(ctx context.Context, req *dto.GetStyleOptionsReq) (res *dto.GetStyleOptionsRes, err error) {
|
|
return service.DigitalHuman.GetStyleOptions(ctx, req)
|
|
}
|