初始化项目

This commit is contained in:
2026-04-27 10:54:32 +08:00
parent 28976d3e7d
commit ba360bc89b
20 changed files with 589 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
package consts
// Age 年龄段类型
type Age string
// 年龄段常量
const (
AgeChild Age = "child" // 儿童
AgeTeenager Age = "teenager" // 青少年
AgeYoung Age = "young" // 青年
AgeMiddle Age = "middle" // 中年
AgeSenior Age = "senior" // 老年
AgeUnlimited Age = "unlimited" // 不限
)
// GetAgeText 获取年龄段文本
func GetAgeText(age string) string {
switch age {
case string(AgeChild):
return "儿童"
case string(AgeTeenager):
return "青少年"
case string(AgeYoung):
return "青年"
case string(AgeMiddle):
return "中年"
case string(AgeSenior):
return "老年"
case string(AgeUnlimited):
return "不限"
default:
return "未知"
}
}
// GetAllAgeKeyValue 获取所有年龄段选项
func GetAllAgeKeyValue() []AgeKeyValue {
return []AgeKeyValue{
{Value: string(AgeChild), Label: "儿童"},
{Value: string(AgeTeenager), Label: "青少年"},
{Value: string(AgeYoung), Label: "青年"},
{Value: string(AgeMiddle), Label: "中年"},
{Value: string(AgeSenior), Label: "老年"},
{Value: string(AgeUnlimited), Label: "不限"},
}
}
// AgeKeyValue 年龄段键值对
type AgeKeyValue struct {
Value string `json:"value"`
Label string `json:"label"`
}

View File

@@ -0,0 +1,40 @@
package consts
// AudioStatus 音频状态类型
type AudioStatus int
// 音频状态常量
const (
AudioStatusGenerating AudioStatus = 0 // 生成中
AudioStatusSuccess AudioStatus = 1 // 成功
AudioStatusFailed AudioStatus = 2 // 失败
)
// GetAudioStatusText 获取音频状态文本
func GetAudioStatusText(status int) string {
switch status {
case int(AudioStatusGenerating):
return "生成中"
case int(AudioStatusSuccess):
return "成功"
case int(AudioStatusFailed):
return "失败"
default:
return "未知"
}
}
// GetAllAudioStatusKeyValue 获取所有音频状态选项
func GetAllAudioStatusKeyValue() []AudioStatusKeyValue {
return []AudioStatusKeyValue{
{Value: int(AudioStatusGenerating), Label: "生成中"},
{Value: int(AudioStatusSuccess), Label: "成功"},
{Value: int(AudioStatusFailed), Label: "失败"},
}
}
// AudioStatusKeyValue 音频状态键值对
type AudioStatusKeyValue struct {
Value int `json:"value"`
Label string `json:"label"`
}

View File

@@ -0,0 +1,8 @@
package consts
// MongoDB集合名称常量
const (
DigitalHumanCollection = "digital_human" // 数字人形象集合
AudioCollection = "audio" // 音频集合
VideoCollection = "video" // 视频集合
)

View File

@@ -0,0 +1,55 @@
package consts
// DigitalHumanStatus 数字人状态类型
type DigitalHumanStatus int
// 数字人状态常量
const (
DigitalHumanStatusInactive DigitalHumanStatus = 0 // 停用
DigitalHumanStatusActive DigitalHumanStatus = 1 // 启用
)
// GetDigitalHumanStatusText 获取数字人状态文本
func GetDigitalHumanStatusText(status int) string {
switch status {
case int(DigitalHumanStatusInactive):
return "停用"
case int(DigitalHumanStatusActive):
return "启用"
default:
return "未知"
}
}
// GetAllDigitalHumanStatusKeyValue 获取所有数字人状态选项
func GetAllDigitalHumanStatusKeyValue() []DigitalHumanStatusKeyValue {
return []DigitalHumanStatusKeyValue{
{Value: int(DigitalHumanStatusInactive), Label: "停用"},
{Value: int(DigitalHumanStatusActive), Label: "启用"},
}
}
// DigitalHumanStatusKeyValue 数字人状态键值对
type DigitalHumanStatusKeyValue struct {
Value int `json:"value"`
Label string `json:"label"`
}
// GetStatusText 获取状态文本(向后兼容)
func GetStatusText(status int) string {
return GetDigitalHumanStatusText(status)
}
// GetAllStatusKeyValue 获取所有状态选项(向后兼容)
func GetAllStatusKeyValue() []StatusKeyValue {
return []StatusKeyValue{
{Value: int(DigitalHumanStatusInactive), Label: "停用"},
{Value: int(DigitalHumanStatusActive), Label: "启用"},
}
}
// StatusKeyValue 状态键值对(向后兼容)
type StatusKeyValue struct {
Value int `json:"value"`
Label string `json:"label"`
}

View File

@@ -0,0 +1,40 @@
package consts
// Gender 性别类型
type Gender string
// 性别常量
const (
GenderMale Gender = "male" // 男
GenderFemale Gender = "female" // 女
GenderOther Gender = "other" // 其他
)
// GetGenderText 获取性别文本
func GetGenderText(gender string) string {
switch gender {
case string(GenderMale):
return "男"
case string(GenderFemale):
return "女"
case string(GenderOther):
return "其他"
default:
return "未知"
}
}
// GetAllGenderKeyValue 获取所有性别选项
func GetAllGenderKeyValue() []GenderKeyValue {
return []GenderKeyValue{
{Value: string(GenderMale), Label: "男"},
{Value: string(GenderFemale), Label: "女"},
{Value: string(GenderOther), Label: "其他"},
}
}
// GenderKeyValue 性别键值对
type GenderKeyValue struct {
Value string `json:"value"`
Label string `json:"label"`
}

View File

@@ -0,0 +1,8 @@
package public
const (
TableNameAudio = "digital_human_audio"
TableNameCustomVoice = "digital_human_custom_voice"
TableNameVideo = "digital_human_video"
TableNameDigitalHuman = "digital_human"
)

View File

@@ -0,0 +1,51 @@
package consts
// Resolution 视频分辨率
type Resolution string
const (
Resolution480P Resolution = "480p" // 标清
Resolution720P Resolution = "720p" // 高清
Resolution1080P Resolution = "1080p" // 全高清
Resolution2K Resolution = "2k" // 2K超清
Resolution4K Resolution = "4k" // 4K超高清
Resolution8K Resolution = "8k" // 8K超高清
)
// Text 获取分辨率文本描述
func (r Resolution) Text() string {
switch r {
case Resolution480P:
return "标清 (480p)"
case Resolution720P:
return "高清 (720p)"
case Resolution1080P:
return "全高清 (1080p)"
case Resolution2K:
return "2K超清 (1440p)"
case Resolution4K:
return "4K超高清 (2160p)"
case Resolution8K:
return "8K超高清 (4320p)"
default:
return string(r)
}
}
// ResolutionKeyValue 分辨率键值对(用于前端选项)
type ResolutionKeyValue struct {
Key string `json:"key"`
Value string `json:"value"`
}
// GetResolutionOptions 获取所有分辨率选项
func GetResolutionOptions() []ResolutionKeyValue {
return []ResolutionKeyValue{
{Key: string(Resolution480P), Value: Resolution480P.Text()},
{Key: string(Resolution720P), Value: Resolution720P.Text()},
{Key: string(Resolution1080P), Value: Resolution1080P.Text()},
{Key: string(Resolution2K), Value: Resolution2K.Text()},
{Key: string(Resolution4K), Value: Resolution4K.Text()},
{Key: string(Resolution8K), Value: Resolution8K.Text()},
}
}

View File

@@ -0,0 +1,60 @@
package consts
// Style 风格类型
type Style string
// 风格常量
const (
StyleBusiness Style = "business" // 商务
StyleCasual Style = "casual" // 休闲
StyleFormal Style = "formal" // 正式
StyleCreative Style = "creative" // 创意
StyleElegant Style = "elegant" // 优雅
StyleFriendly Style = "friendly" // 友好
StyleProfessional Style = "professional" // 专业
StyleUnlimited Style = "unlimited" // 不限
)
// GetStyleText 获取风格文本
func GetStyleText(style string) string {
switch style {
case string(StyleBusiness):
return "商务"
case string(StyleCasual):
return "休闲"
case string(StyleFormal):
return "正式"
case string(StyleCreative):
return "创意"
case string(StyleElegant):
return "优雅"
case string(StyleFriendly):
return "友好"
case string(StyleProfessional):
return "专业"
case string(StyleUnlimited):
return "不限"
default:
return "未知"
}
}
// GetAllStyleKeyValue 获取所有风格选项
func GetAllStyleKeyValue() []StyleKeyValue {
return []StyleKeyValue{
{Value: string(StyleBusiness), Label: "商务"},
{Value: string(StyleCasual), Label: "休闲"},
{Value: string(StyleFormal), Label: "正式"},
{Value: string(StyleCreative), Label: "创意"},
{Value: string(StyleElegant), Label: "优雅"},
{Value: string(StyleFriendly), Label: "友好"},
{Value: string(StyleProfessional), Label: "专业"},
{Value: string(StyleUnlimited), Label: "不限"},
}
}
// StyleKeyValue 风格键值对
type StyleKeyValue struct {
Value string `json:"value"`
Label string `json:"label"`
}

View File

@@ -0,0 +1,40 @@
package consts
// VideoStatus 视频状态类型
type VideoStatus int
// 视频生成状态常量
const (
VideoStatusGenerating VideoStatus = 0 // 生成中
VideoStatusSuccess VideoStatus = 1 // 成功
VideoStatusFailed VideoStatus = 2 // 失败
)
// GetVideoStatusText 获取视频状态文本
func GetVideoStatusText(status int) string {
switch status {
case int(VideoStatusGenerating):
return "生成中"
case int(VideoStatusSuccess):
return "成功"
case int(VideoStatusFailed):
return "失败"
default:
return "未知"
}
}
// GetAllVideoStatusKeyValue 获取所有视频状态选项
func GetAllVideoStatusKeyValue() []VideoStatusKeyValue {
return []VideoStatusKeyValue{
{Value: int(VideoStatusGenerating), Label: "生成中"},
{Value: int(VideoStatusSuccess), Label: "成功"},
{Value: int(VideoStatusFailed), Label: "失败"},
}
}
// VideoStatusKeyValue 视频状态键值对
type VideoStatusKeyValue struct {
Value int `json:"value"`
Label string `json:"label"`
}