|
@@ -5,6 +5,7 @@ import (
|
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm"
|
|
|
"speechAnalysis/constvar"
|
|
"speechAnalysis/constvar"
|
|
|
"speechAnalysis/pkg/mysqlx"
|
|
"speechAnalysis/pkg/mysqlx"
|
|
|
|
|
+ "strings"
|
|
|
"time"
|
|
"time"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -14,7 +15,7 @@ type (
|
|
|
gorm.Model
|
|
gorm.Model
|
|
|
Name string `gorm:"index;type:varchar(255);not null;default:'';comment:音频名称" json:"name"` // 音频名称
|
|
Name string `gorm:"index;type:varchar(255);not null;default:'';comment:音频名称" json:"name"` // 音频名称
|
|
|
Size int64 `gorm:"type:int;not null;default:0;comment:文件大小" json:"size"` // 音频大小
|
|
Size int64 `gorm:"type:int;not null;default:0;comment:文件大小" json:"size"` // 音频大小
|
|
|
- FilePath string `gorm:"type:varchar(255);not null;default:'';comment:音频名称" json:"-"` //音频路径 // 音频路径
|
|
|
|
|
|
|
+ FilePath string `gorm:"type:varchar(255);not null;default:'';comment:音频路径" json:"-"` //音频路径 // 音频路径
|
|
|
AudioStatus constvar.AudioStatus `gorm:"type:tinyint;not null;default:0;comment:状态" json:"audioStatus"` // 音频状态
|
|
AudioStatus constvar.AudioStatus `gorm:"type:tinyint;not null;default:0;comment:状态" json:"audioStatus"` // 音频状态
|
|
|
LocomotiveNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:机车号" json:"locomotiveNumber"` // 机车号
|
|
LocomotiveNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:机车号" json:"locomotiveNumber"` // 机车号
|
|
|
TrainNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:车次" json:"trainNumber"` // 车次
|
|
TrainNumber string `gorm:"index;type:varchar(255);not null;default:'';comment:车次" json:"trainNumber"` // 车次
|
|
@@ -22,10 +23,11 @@ type (
|
|
|
Station string `gorm:"index;type:varchar(255);not null;default:'';comment:车站号" json:"station"` // 车站
|
|
Station string `gorm:"index;type:varchar(255);not null;default:'';comment:车站号" json:"station"` // 车站
|
|
|
OccurrenceAt time.Time `json:"-"`
|
|
OccurrenceAt time.Time `json:"-"`
|
|
|
OccurrenceTime string `json:"occurrenceTime" gorm:"-"`
|
|
OccurrenceTime string `json:"occurrenceTime" gorm:"-"`
|
|
|
- IsFollowed constvar.BoolType `gorm:"type:tinyint;not null;default:2;comment:是否关注"` //是否关注 1关注 2未关注
|
|
|
|
|
- Score float64 `json:"score"` // 置信度
|
|
|
|
|
- Words []string `json:"words" gorm:"-"` //匹配到的文字数组
|
|
|
|
|
- AudioText string `json:"audioText" gorm:"-"` //解析出的文本
|
|
|
|
|
|
|
+ IsFollowed constvar.BoolType `gorm:"type:tinyint;not null;default:2;comment:是否关注"` //是否关注 1关注 2未关注
|
|
|
|
|
+ Score float64 `json:"score"` // 置信度
|
|
|
|
|
+ Words []string `json:"words" gorm:"-"` //匹配到的文字数组
|
|
|
|
|
+ Tags string `json:"-" gorm:"type:varchar(255);not null;default:'';comment:匹配到的文字,用逗号拼接"` //匹配到的文字
|
|
|
|
|
+ AudioText string `json:"audioText" gorm:"-"` //解析出的文本
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
AudioSearch struct {
|
|
AudioSearch struct {
|
|
@@ -49,8 +51,12 @@ func (slf *Audio) AfterFind(tx *gorm.DB) (err error) {
|
|
|
} else {
|
|
} else {
|
|
|
slf.OccurrenceTime = slf.OccurrenceAt.Format("2006-01-02 15:04:05")
|
|
slf.OccurrenceTime = slf.OccurrenceAt.Format("2006-01-02 15:04:05")
|
|
|
}
|
|
}
|
|
|
|
|
+ if slf.Tags != "" {
|
|
|
|
|
+ slf.Words = strings.Split(slf.Tags, ",")
|
|
|
|
|
+ }
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
func NewAudioSearch() *AudioSearch {
|
|
func NewAudioSearch() *AudioSearch {
|
|
|
return &AudioSearch{Orm: mysqlx.GetDB()}
|
|
return &AudioSearch{Orm: mysqlx.GetDB()}
|
|
|
}
|
|
}
|