From 0357939d4ab2a10ae3678e2285d012c713c26963 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 16 五月 2024 16:08:18 +0800
Subject: [PATCH] 解析结果匹配文字库并保存

---
 models/audio.go |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/models/audio.go b/models/audio.go
index 842f8e9..8d1b51f 100644
--- a/models/audio.go
+++ b/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"`       // 杞︽
@@ -22,10 +23,11 @@
 		Station          string               `gorm:"index;type:varchar(255);not null;default:'';comment:杞︾珯鍙�" json:"station"`          // 杞︾珯
 		OccurrenceAt     time.Time            `json:"-"`
 		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:"-"`                           //瑙f瀽鍑虹殑鏂囨湰
+		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:"-"`                                                  //瑙f瀽鍑虹殑鏂囨湰
 	}
 
 	AudioSearch struct {
@@ -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()}
 }

--
Gitblit v1.8.0