feat: 音色管理

This commit is contained in:
Blizzard
2026-03-26 11:26:10 +08:00
parent df74da48bd
commit 5f4f739f16
11 changed files with 542 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package radio
import (
"sundynix-go/global"
"sundynix-go/model/system"
)
// RadioVoice 音色管理表
type RadioVoice struct {
global.BaseModel
SpeakerId string `gorm:"size:50;uniqueIndex" json:"speakerId"` // 音色ID (火山引擎的speaker值)
Name string `gorm:"size:50" json:"name"` // 音色名称
Description string `gorm:"size:255" json:"description"` // 音色描述
Gender string `gorm:"size:10" json:"gender"` // 性别: male/female/neutral
Icon string `gorm:"size:255" json:"icon"` // 音色图标URL
AudioId string `gorm:"size:50" json:"audioId"` // 试听音频OSS ID
Audio *system.Oss `gorm:"foreignKey:AudioId" json:"audio"` // 试听音频OSS
Sort int `gorm:"default:0" json:"sort"` // 排序
Status int `gorm:"default:1" json:"status"` // 状态 0:禁用 1:启用
IsDefault int `gorm:"default:0" json:"isDefault"` // 是否默认音色 0:否 1:是
UseCount int `gorm:"default:0" json:"useCount"` // 使用次数
}
func (RadioVoice) TableName() string {
return "sundynix_radio_voice"
}
+37
View File
@@ -0,0 +1,37 @@
package request
import common "sundynix-go/model/commom/request"
// GetVoiceList 获取音色列表请求
type GetVoiceList struct {
common.PageInfo
Name string `json:"name" form:"name"` // 音色名称
Status int `json:"status" form:"status"` // 状态
}
// SaveVoice 保存音色请求
type SaveVoice struct {
SpeakerId string `json:"speakerId" binding:"required"` // 音色ID
Name string `json:"name" binding:"required"` // 音色名称
Description string `json:"description"` // 音色描述
Gender string `json:"gender"` // 性别: male/female/neutral
Icon string `json:"icon"` // 音色图标URL
AudioId string `json:"audioId"` // 试听音频OSS ID
Sort int `json:"sort"` // 排序
Status int `json:"status"` // 状态
IsDefault int `json:"isDefault"` // 是否默认音色
}
// UpdateVoice 更新音色请求
type UpdateVoice struct {
Id string `json:"id" binding:"required"` // 音色ID
SpeakerId string `json:"speakerId"` // 音色ID
Name string `json:"name"` // 音色名称
Description string `json:"description"` // 音色描述
Gender string `json:"gender"` // 性别
Icon string `json:"icon"` // 音色图标URL
AudioId string `json:"audioId"` // 试听音频OSS ID
Sort int `json:"sort"` // 排序
Status int `json:"status"` // 状态
IsDefault int `json:"isDefault"` // 是否默认音色
}
+37
View File
@@ -0,0 +1,37 @@
package response
import "sundynix-go/model/system"
// VoiceResponse 音色响应
type VoiceResponse struct {
Id string `json:"id"`
SpeakerId string `json:"speakerId"`
Name string `json:"name"`
Description string `json:"description"`
Gender string `json:"gender"`
Icon string `json:"icon"`
AudioId string `json:"audioId"`
Audio *system.Oss `json:"audio"` // 试听音频OSS
Sort int `json:"sort"`
Status int `json:"status"`
IsDefault int `json:"isDefault"`
UseCount int `json:"useCount"`
}
// VoiceDetailResponse 音色详情响应
type VoiceDetailResponse struct {
Id string `json:"id"`
SpeakerId string `json:"speakerId"`
Name string `json:"name"`
Description string `json:"description"`
Gender string `json:"gender"`
Icon string `json:"icon"`
AudioId string `json:"audioId"`
Audio *system.Oss `json:"audio"` // 试听音频OSS
Sort int `json:"sort"`
Status int `json:"status"`
IsDefault int `json:"isDefault"`
UseCount int `json:"useCount"`
CreateTime string `json:"createTime"`
UpdateTime string `json:"updateTime"`
}