zhangqian
2024-05-16 0357939d4ab2a10ae3678e2285d012c713c26963
models/audio.go
@@ -5,6 +5,7 @@
   "gorm.io/gorm"
   "speechAnalysis/constvar"
   "speechAnalysis/pkg/mysqlx"
   "strings"
   "time"
)
@@ -14,7 +15,7 @@
      gorm.Model
      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"`                            // 音频大小
      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"`                   // 音频状态
      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"`       // 车次
@@ -25,6 +26,7 @@
      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:"-"`                           //解析出的文本
   }
@@ -49,8 +51,12 @@
   } else {
      slf.OccurrenceTime = slf.OccurrenceAt.Format("2006-01-02 15:04:05")
   }
   if slf.Tags != "" {
      slf.Words = strings.Split(slf.Tags, ",")
   }
   return
}
func NewAudioSearch() *AudioSearch {
   return &AudioSearch{Orm: mysqlx.GetDB()}
}