引包目录名调整
This commit is contained in:
61
digital-human/controller/custom_voice_controller.go
Normal file
61
digital-human/controller/custom_voice_controller.go
Normal file
@@ -0,0 +1,61 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"ai-agent/digital-human/model/dto"
|
||||
"ai-agent/digital-human/service"
|
||||
"context"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
type customVoice struct{}
|
||||
|
||||
// CustomVoice 自定义音色控制器
|
||||
var CustomVoice = new(customVoice)
|
||||
|
||||
// CreateCustomVoice 创建自定义音色
|
||||
func (c *customVoice) CreateCustomVoice(ctx context.Context, req *dto.CreateCustomVoiceReq) (res *dto.CreateCustomVoiceRes, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.CustomVoice.CreateCustomVoice(ctx, req)
|
||||
}
|
||||
|
||||
// ListCustomVoices 获取自定义音色列表
|
||||
func (c *customVoice) ListCustomVoices(ctx context.Context, req *dto.ListCustomVoiceReq) (res *dto.ListCustomVoiceRes, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
return service.CustomVoice.ListCustomVoices(ctx, req)
|
||||
}
|
||||
|
||||
// DeleteCustomVoice 删除自定义音色
|
||||
func (c *customVoice) DeleteCustomVoice(ctx context.Context, req *dto.DeleteCustomVoiceReq) (res *beans.ResponseEmpty, err error) {
|
||||
// 从上下文获取用户信息
|
||||
if ctx.Value("userId") == nil {
|
||||
ctx = context.WithValue(ctx, "userId", gconv.String(1))
|
||||
}
|
||||
if ctx.Value("userName") == nil {
|
||||
ctx = context.WithValue(ctx, "userName", "admin")
|
||||
}
|
||||
if ctx.Value("tenantId") == nil {
|
||||
ctx = context.WithValue(ctx, "tenantId", uint64(1))
|
||||
}
|
||||
err = service.CustomVoice.DeleteCustomVoice(ctx, req)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user