From 3eb829393c22b975b9ca7e0e022150d4cafa9bd1 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 16 五月 2024 15:29:32 +0800
Subject: [PATCH] 增加音频详情接口,返回解析的文字

---
 controllers/text.go  |   12 
 request/audio.go     |    2 
 models/train.go      |    2 
 models/audio.go      |    2 
 docs/swagger.yaml    |   72 ++++++--
 controllers/audio.go |   27 +++
 docs/docs.go         |  109 ++++++++++---
 conf/config.yaml     |    2 
 docs/swagger.json    |  109 ++++++++++---
 response/audio.go    |    2 
 models/text.go       |   80 +++++-----
 router/router.go     |    1 
 models/db.go         |    2 
 13 files changed, 297 insertions(+), 125 deletions(-)

diff --git a/conf/config.yaml b/conf/config.yaml
index 7ac8b6a..6e08859 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -1,5 +1,5 @@
 web:
-  port: 8102
+  port: 8203
   host: 192.168.20.119
 db:
   dsn: root:c++java123@tcp(192.168.20.119:3306)/speech_analysis?charset=utf8&parseTime=True&loc=Local
diff --git a/controllers/audio.go b/controllers/audio.go
index 1326952..ad13a82 100644
--- a/controllers/audio.go
+++ b/controllers/audio.go
@@ -211,6 +211,33 @@
 	util.ResponseFormat(c, code.UpdateSuccess, "鎴愬姛")
 }
 
+// AudioInfo
+// @Tags      闊抽
+// @Summary   闊抽璇︽儏锛屽惈瑙f瀽缁撴灉
+// @Produce   application/json
+// @Param     object  query request.ProcessAudio true  "鍙傛暟"
+// @Success   200 {object} util.Response{data=models.Audio} "鎴愬姛"
+// @Router    /api-sa/v1/audio/info [get]
+func (slf AudioCtl) AudioInfo(c *gin.Context) {
+	var params request.ProcessAudio
+	if err := c.ShouldBindQuery(&params); err != nil {
+		util.ResponseFormat(c, code.RequestParamError, err.Error())
+		return
+	}
+
+	audio, err := models.NewAudioSearch().SetID(params.ID).First()
+	if err != nil {
+		util.ResponseFormat(c, code.InternalError, "璇锋眰澶辫触")
+		return
+	}
+	audioText, err := models.NewAudioTextSearch().SetAudioID(audio.ID).First()
+	if err == nil {
+		audio.AudioText = audioText.AudioText
+	}
+
+	util.ResponseFormat(c, code.UpdateSuccess, audio)
+}
+
 // BatchProcess
 // @Tags      闊抽
 // @Summary   鎵归噺澶勭悊闊抽
diff --git a/controllers/text.go b/controllers/text.go
index 625e367..1363327 100644
--- a/controllers/text.go
+++ b/controllers/text.go
@@ -27,7 +27,7 @@
 		return
 	}
 
-	text := models.Text{
+	text := models.Word{
 		Content:          req.Content,
 		LocomotiveNumber: req.LocomotiveNumber,
 	}
@@ -37,7 +37,7 @@
 		return
 	}
 
-	if err := models.NewTextSearch().Create(&text); err != nil {
+	if err := models.NewWordSearch().Create(&text); err != nil {
 		util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛岃妫�鏌ユ槸鍚﹂噸澶�")
 		return
 	}
@@ -45,11 +45,11 @@
 	util.ResponseFormat(c, code.Success, "娣诲姞鎴愬姛")
 }
 
-func (slf TextCtl) paramsCheck(text models.Text) (err error) {
+func (slf TextCtl) paramsCheck(text models.Word) (err error) {
 	if text.Content == "" || text.LocomotiveNumber == "" {
 		return errors.New("鍙傛暟缂哄け")
 	}
-	_, err = models.NewTextSearch().SetLocomotiveNumber(text.LocomotiveNumber).SetContent(text.Content).First()
+	_, err = models.NewWordSearch().SetLocomotiveNumber(text.LocomotiveNumber).SetContent(text.Content).First()
 	if err == nil {
 		return errors.New("鏂囧瓧閲嶅")
 	}
@@ -61,7 +61,7 @@
 // @Summary   鏂囧瓧搴撳垪琛�
 // @Produce   application/json
 // @Param     object  query    request.GetTextList true  "鍙傛暟"
-// @Success   200   {object}  util.ResponseList{data=[]models.Text}  "鎴愬姛"
+// @Success   200   {object}  util.ResponseList{data=[]models.Word}  "鎴愬姛"
 // @Router    /api-sa/v1/text/list [get]
 func (slf TextCtl) List(c *gin.Context) {
 	var params request.GetTextList
@@ -75,7 +75,7 @@
 		return
 	}
 
-	list, total, err := models.NewTextSearch().
+	list, total, err := models.NewWordSearch().
 		SetPage(params.Page, params.PageSize).
 		SetKeyword(params.Keyword).
 		Find()
diff --git a/docs/docs.go b/docs/docs.go
index 64c129c..c225b57 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -148,6 +148,45 @@
                 }
             }
         },
+        "/api-sa/v1/audio/info": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "闊抽"
+                ],
+                "summary": "闊抽璇︽儏锛屽惈瑙f瀽缁撴灉",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.Audio"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/api-sa/v1/audio/list": {
             "get": {
                 "produces": [
@@ -432,7 +471,7 @@
                                         "data": {
                                             "type": "array",
                                             "items": {
-                                                "$ref": "#/definitions/models.Text"
+                                                "$ref": "#/definitions/models.Word"
                                             }
                                         }
                                     }
@@ -525,6 +564,10 @@
                         }
                     ]
                 },
+                "audioText": {
+                    "description": "瑙f瀽鍑虹殑鏂囨湰",
+                    "type": "string"
+                },
                 "createdAt": {
                     "type": "string"
                 },
@@ -575,31 +618,13 @@
                 },
                 "updatedAt": {
                     "type": "string"
-                }
-            }
-        },
-        "models.Text": {
-            "type": "object",
-            "properties": {
-                "content": {
-                    "description": "闊抽鍚嶇О",
-                    "type": "string"
                 },
-                "createdAt": {
-                    "type": "string"
-                },
-                "deletedAt": {
-                    "$ref": "#/definitions/gorm.DeletedAt"
-                },
-                "id": {
-                    "type": "integer"
-                },
-                "locomotiveNumber": {
-                    "description": "鏈鸿溅鍙�",
-                    "type": "string"
-                },
-                "updatedAt": {
-                    "type": "string"
+                "words": {
+                    "description": "鍖归厤鍒扮殑鏂囧瓧鏁扮粍",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
                 }
             }
         },
@@ -607,7 +632,7 @@
             "type": "object",
             "properties": {
                 "class": {
-                    "description": "鍒嗙被",
+                    "description": "鍒嗙被  1 鏈鸿溅 2杞︽ 3 杞︾珯",
                     "allOf": [
                         {
                             "$ref": "#/definitions/constvar.Class"
@@ -630,6 +655,31 @@
                 "parentID": {
                     "description": "涓婄骇id",
                     "type": "integer"
+                },
+                "updatedAt": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.Word": {
+            "type": "object",
+            "properties": {
+                "content": {
+                    "description": "鏂囧瓧",
+                    "type": "string"
+                },
+                "createdAt": {
+                    "type": "string"
+                },
+                "deletedAt": {
+                    "$ref": "#/definitions/gorm.DeletedAt"
+                },
+                "id": {
+                    "type": "integer"
+                },
+                "locomotiveNumber": {
+                    "description": "鏈鸿溅鍙�",
+                    "type": "string"
                 },
                 "updatedAt": {
                     "type": "string"
@@ -693,7 +743,12 @@
             "type": "object",
             "properties": {
                 "followStatus": {
-                    "$ref": "#/definitions/constvar.BoolType"
+                    "description": "1 宸插叧娉� 2鏈叧娉�",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.BoolType"
+                        }
+                    ]
                 }
             }
         },
diff --git a/docs/swagger.json b/docs/swagger.json
index f946de2..46229b6 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -136,6 +136,45 @@
                 }
             }
         },
+        "/api-sa/v1/audio/info": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "闊抽"
+                ],
+                "summary": "闊抽璇︽儏锛屽惈瑙f瀽缁撴灉",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "name": "id",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "鎴愬姛",
+                        "schema": {
+                            "allOf": [
+                                {
+                                    "$ref": "#/definitions/util.Response"
+                                },
+                                {
+                                    "type": "object",
+                                    "properties": {
+                                        "data": {
+                                            "$ref": "#/definitions/models.Audio"
+                                        }
+                                    }
+                                }
+                            ]
+                        }
+                    }
+                }
+            }
+        },
         "/api-sa/v1/audio/list": {
             "get": {
                 "produces": [
@@ -420,7 +459,7 @@
                                         "data": {
                                             "type": "array",
                                             "items": {
-                                                "$ref": "#/definitions/models.Text"
+                                                "$ref": "#/definitions/models.Word"
                                             }
                                         }
                                     }
@@ -513,6 +552,10 @@
                         }
                     ]
                 },
+                "audioText": {
+                    "description": "瑙f瀽鍑虹殑鏂囨湰",
+                    "type": "string"
+                },
                 "createdAt": {
                     "type": "string"
                 },
@@ -563,31 +606,13 @@
                 },
                 "updatedAt": {
                     "type": "string"
-                }
-            }
-        },
-        "models.Text": {
-            "type": "object",
-            "properties": {
-                "content": {
-                    "description": "闊抽鍚嶇О",
-                    "type": "string"
                 },
-                "createdAt": {
-                    "type": "string"
-                },
-                "deletedAt": {
-                    "$ref": "#/definitions/gorm.DeletedAt"
-                },
-                "id": {
-                    "type": "integer"
-                },
-                "locomotiveNumber": {
-                    "description": "鏈鸿溅鍙�",
-                    "type": "string"
-                },
-                "updatedAt": {
-                    "type": "string"
+                "words": {
+                    "description": "鍖归厤鍒扮殑鏂囧瓧鏁扮粍",
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
                 }
             }
         },
@@ -595,7 +620,7 @@
             "type": "object",
             "properties": {
                 "class": {
-                    "description": "鍒嗙被",
+                    "description": "鍒嗙被  1 鏈鸿溅 2杞︽ 3 杞︾珯",
                     "allOf": [
                         {
                             "$ref": "#/definitions/constvar.Class"
@@ -618,6 +643,31 @@
                 "parentID": {
                     "description": "涓婄骇id",
                     "type": "integer"
+                },
+                "updatedAt": {
+                    "type": "string"
+                }
+            }
+        },
+        "models.Word": {
+            "type": "object",
+            "properties": {
+                "content": {
+                    "description": "鏂囧瓧",
+                    "type": "string"
+                },
+                "createdAt": {
+                    "type": "string"
+                },
+                "deletedAt": {
+                    "$ref": "#/definitions/gorm.DeletedAt"
+                },
+                "id": {
+                    "type": "integer"
+                },
+                "locomotiveNumber": {
+                    "description": "鏈鸿溅鍙�",
+                    "type": "string"
                 },
                 "updatedAt": {
                     "type": "string"
@@ -681,7 +731,12 @@
             "type": "object",
             "properties": {
                 "followStatus": {
-                    "$ref": "#/definitions/constvar.BoolType"
+                    "description": "1 宸插叧娉� 2鏈叧娉�",
+                    "allOf": [
+                        {
+                            "$ref": "#/definitions/constvar.BoolType"
+                        }
+                    ]
                 }
             }
         },
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index fc611f7..e16406b 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -58,6 +58,9 @@
         allOf:
         - $ref: '#/definitions/constvar.AudioStatus'
         description: 闊抽鐘舵��
+      audioText:
+        description: 瑙f瀽鍑虹殑鏂囨湰
+        type: string
       createdAt:
         type: string
       deletedAt:
@@ -93,30 +96,18 @@
         type: string
       updatedAt:
         type: string
-    type: object
-  models.Text:
-    properties:
-      content:
-        description: 闊抽鍚嶇О
-        type: string
-      createdAt:
-        type: string
-      deletedAt:
-        $ref: '#/definitions/gorm.DeletedAt'
-      id:
-        type: integer
-      locomotiveNumber:
-        description: 鏈鸿溅鍙�
-        type: string
-      updatedAt:
-        type: string
+      words:
+        description: 鍖归厤鍒扮殑鏂囧瓧鏁扮粍
+        items:
+          type: string
+        type: array
     type: object
   models.TrainInfo:
     properties:
       class:
         allOf:
         - $ref: '#/definitions/constvar.Class'
-        description: 鍒嗙被
+        description: 鍒嗙被  1 鏈鸿溅 2杞︽ 3 杞︾珯
       createdAt:
         type: string
       deletedAt:
@@ -129,6 +120,23 @@
       parentID:
         description: 涓婄骇id
         type: integer
+      updatedAt:
+        type: string
+    type: object
+  models.Word:
+    properties:
+      content:
+        description: 鏂囧瓧
+        type: string
+      createdAt:
+        type: string
+      deletedAt:
+        $ref: '#/definitions/gorm.DeletedAt'
+      id:
+        type: integer
+      locomotiveNumber:
+        description: 鏈鸿溅鍙�
+        type: string
       updatedAt:
         type: string
     type: object
@@ -170,7 +178,9 @@
   response.FollowResp:
     properties:
       followStatus:
-        $ref: '#/definitions/constvar.BoolType'
+        allOf:
+        - $ref: '#/definitions/constvar.BoolType'
+        description: 1 宸插叧娉� 2鏈叧娉�
     type: object
   util.Response:
     properties:
@@ -276,6 +286,28 @@
                   $ref: '#/definitions/response.FollowResp'
               type: object
       summary: 鍏虫敞/鍙栨秷鍏虫敞
+      tags:
+      - 闊抽
+  /api-sa/v1/audio/info:
+    get:
+      parameters:
+      - in: query
+        name: id
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: 鎴愬姛
+          schema:
+            allOf:
+            - $ref: '#/definitions/util.Response'
+            - properties:
+                data:
+                  $ref: '#/definitions/models.Audio'
+              type: object
+      summary: 闊抽璇︽儏锛屽惈瑙f瀽缁撴灉
       tags:
       - 闊抽
   /api-sa/v1/audio/list:
@@ -456,7 +488,7 @@
             - properties:
                 data:
                   items:
-                    $ref: '#/definitions/models.Text'
+                    $ref: '#/definitions/models.Word'
                   type: array
               type: object
       summary: 鏂囧瓧搴撳垪琛�
diff --git a/models/audio.go b/models/audio.go
index 45331be..842f8e9 100644
--- a/models/audio.go
+++ b/models/audio.go
@@ -24,6 +24,8 @@
 		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瀽鍑虹殑鏂囨湰
 	}
 
 	AudioSearch struct {
diff --git a/models/db.go b/models/db.go
index e19e158..1887cb0 100644
--- a/models/db.go
+++ b/models/db.go
@@ -75,7 +75,7 @@
 	err := db.AutoMigrate(
 		Audio{},
 		AudioText{},
-		Text{},
+		Word{},
 		TrainInfo{},
 	)
 	return err
diff --git a/models/text.go b/models/text.go
index 4b4d2b9..1818ee0 100644
--- a/models/text.go
+++ b/models/text.go
@@ -7,15 +7,15 @@
 )
 
 type (
-	// Text 鏂囧瓧
-	Text struct {
+	// Word 鏂囧瓧
+	Word struct {
 		gorm.Model
-		Content          string `gorm:"uniqueIndex:locomotive_number_text;type:varchar(255);not null;default:'';comment:闊抽鍚嶇О" json:"content"`         // 闊抽鍚嶇О
-		LocomotiveNumber string `gorm:"uniqueIndex:locomotive_number_text;type:varchar(255);not null;default:'';comment:鏈鸿溅鍙�" json:"locomotiveNumber"` // 鏈鸿溅鍙�
+		Content          string `gorm:"uniqueIndex:locomotive_number_Word;type:varchar(255);not null;default:'';comment:闊抽鍚嶇О" json:"content"`         // 鏂囧瓧
+		LocomotiveNumber string `gorm:"uniqueIndex:locomotive_number_Word;type:varchar(255);not null;default:'';comment:鏈鸿溅鍙�" json:"locomotiveNumber"` // 鏈鸿溅鍙�
 	}
 
-	TextSearch struct {
-		Text
+	WordSearch struct {
+		Word
 		Order    string
 		PageNum  int
 		PageSize int
@@ -25,55 +25,55 @@
 	}
 )
 
-func (slf *Text) TableName() string {
-	return "text"
+func (slf *Word) TableName() string {
+	return "word"
 }
 
-func NewTextSearch() *TextSearch {
-	return &TextSearch{Orm: mysqlx.GetDB()}
+func NewWordSearch() *WordSearch {
+	return &WordSearch{Orm: mysqlx.GetDB()}
 }
 
-func (slf *TextSearch) SetOrm(tx *gorm.DB) *TextSearch {
+func (slf *WordSearch) SetOrm(tx *gorm.DB) *WordSearch {
 	slf.Orm = tx
 	return slf
 }
 
-func (slf *TextSearch) SetPage(page, size int) *TextSearch {
+func (slf *WordSearch) SetPage(page, size int) *WordSearch {
 	slf.PageNum, slf.PageSize = page, size
 	return slf
 }
 
-func (slf *TextSearch) SetOrder(order string) *TextSearch {
+func (slf *WordSearch) SetOrder(order string) *WordSearch {
 	slf.Order = order
 	return slf
 }
 
-func (slf *TextSearch) SetID(id uint) *TextSearch {
+func (slf *WordSearch) SetID(id uint) *WordSearch {
 	slf.ID = id
 	return slf
 }
 
-func (slf *TextSearch) SetIDs(ids []uint) *TextSearch {
+func (slf *WordSearch) SetIDs(ids []uint) *WordSearch {
 	slf.IDs = ids
 	return slf
 }
 
-func (slf *TextSearch) SetKeyword(kw string) *TextSearch {
+func (slf *WordSearch) SetKeyword(kw string) *WordSearch {
 	slf.Keyword = kw
 	return slf
 }
 
-func (slf *TextSearch) SetLocomotiveNumber(number string) *TextSearch {
+func (slf *WordSearch) SetLocomotiveNumber(number string) *WordSearch {
 	slf.LocomotiveNumber = number
 	return slf
 }
 
-func (slf *TextSearch) SetContent(content string) *TextSearch {
+func (slf *WordSearch) SetContent(content string) *WordSearch {
 	slf.Content = content
 	return slf
 }
 
-func (slf *TextSearch) build() *gorm.DB {
+func (slf *WordSearch) build() *gorm.DB {
 	var db = slf.Orm.Table(slf.TableName())
 
 	if slf.ID != 0 {
@@ -105,7 +105,7 @@
 }
 
 // Create 鍗曟潯鎻掑叆
-func (slf *TextSearch) Create(record *Text) error {
+func (slf *WordSearch) Create(record *Word) error {
 	var db = slf.build()
 
 	if err := db.Create(record).Error; err != nil {
@@ -116,7 +116,7 @@
 }
 
 // CreateBatch 鎵归噺鎻掑叆
-func (slf *TextSearch) CreateBatch(records []*Text) error {
+func (slf *WordSearch) CreateBatch(records []*Word) error {
 	var db = slf.build()
 
 	if err := db.Create(&records).Error; err != nil {
@@ -126,7 +126,7 @@
 	return nil
 }
 
-func (slf *TextSearch) Save(record *Text) error {
+func (slf *WordSearch) Save(record *Word) error {
 	var db = slf.build()
 
 	if err := db.Omit("CreatedAt").Save(record).Error; err != nil {
@@ -136,7 +136,7 @@
 	return nil
 }
 
-func (slf *TextSearch) UpdateByMap(upMap map[string]interface{}) error {
+func (slf *WordSearch) UpdateByMap(upMap map[string]interface{}) error {
 	var (
 		db = slf.build()
 	)
@@ -148,7 +148,7 @@
 	return nil
 }
 
-func (slf *TextSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error {
+func (slf *WordSearch) UpdateByQuery(query string, args []interface{}, upMap map[string]interface{}) error {
 	var (
 		db = slf.Orm.Table(slf.TableName()).Where(query, args...)
 	)
@@ -160,19 +160,19 @@
 	return nil
 }
 
-func (slf *TextSearch) Delete() error {
+func (slf *WordSearch) Delete() error {
 	var db = slf.build()
 
-	if err := db.Delete(&Text{}).Error; err != nil {
+	if err := db.Delete(&Word{}).Error; err != nil {
 		return err
 	}
 
 	return nil
 }
 
-func (slf *TextSearch) First() (*Text, error) {
+func (slf *WordSearch) First() (*Word, error) {
 	var (
-		record = new(Text)
+		record = new(Word)
 		db     = slf.build()
 	)
 
@@ -183,9 +183,9 @@
 	return record, nil
 }
 
-func (slf *TextSearch) Find() ([]*Text, int, error) {
+func (slf *WordSearch) Find() ([]*Word, int, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		total   int64
 		db      = slf.build()
 	)
@@ -203,9 +203,9 @@
 	return records, int(total), nil
 }
 
-func (slf *TextSearch) FindNotTotal() ([]*Text, error) {
+func (slf *WordSearch) FindNotTotal() ([]*Word, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		db      = slf.build()
 	)
 
@@ -220,9 +220,9 @@
 }
 
 // FindByQuery 鎸囧畾鏉′欢鏌ヨ.
-func (slf *TextSearch) FindByQuery(query string, args []interface{}) ([]*Text, int64, error) {
+func (slf *WordSearch) FindByQuery(query string, args []interface{}) ([]*Word, int64, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		total   int64
 		db      = slf.Orm.Table(slf.TableName()).Where(query, args...)
 	)
@@ -241,9 +241,9 @@
 }
 
 // FindAll 鎸囧畾鏉′欢鏌ヨ&涓嶅垎椤�.
-func (slf *TextSearch) FindAll(query string, args []interface{}) ([]*Text, error) {
+func (slf *WordSearch) FindAll(query string, args []interface{}) ([]*Word, error) {
 	var (
-		records = make([]*Text, 0)
+		records = make([]*Word, 0)
 		db      = slf.Orm.Table(slf.TableName()).Where(query, args...)
 	)
 
@@ -255,7 +255,7 @@
 }
 
 //// InitDefaultData 鍒濆鍖栨暟鎹�
-//func (slf *TextSearch) InitDefaultData() error {
+//func (slf *WordSearch) InitDefaultData() error {
 //	var (
 //		db          = slf.Orm.Table(slf.TableName())
 //		total int64 = 0
@@ -266,7 +266,7 @@
 //	if total != 0 {
 //		return nil
 //	}
-//	Texts := make([]*Text, 0, 3)
-//	Texts = append(Texts, &Text{Name: "璐㈠姟閮�", Number: "cwb"})
-//	return slf.CreateBatch(Texts)
+//	Words := make([]*Word, 0, 3)
+//	Words = append(Words, &Word{Name: "璐㈠姟閮�", Number: "cwb"})
+//	return slf.CreateBatch(Words)
 //}
diff --git a/models/train.go b/models/train.go
index 025dc96..3031015 100644
--- a/models/train.go
+++ b/models/train.go
@@ -12,7 +12,7 @@
 	TrainInfo struct {
 		gorm.Model
 		Name     string         `gorm:"type:varchar(255);not null;default:'';comment:鍚嶇О" json:"name"` //鍚嶇О
-		Class    constvar.Class `gorm:"type:tinyint;not null;default:0;comment:鍒嗙被" json:"class"`      //鍒嗙被
+		Class    constvar.Class `gorm:"type:tinyint;not null;default:0;comment:鍒嗙被" json:"class"`      //鍒嗙被  1 鏈鸿溅 2杞︽ 3 杞︾珯
 		ParentID uint           `gorm:"type:int;not null;default 0; comment:涓婄骇id" json:"parentID"`    //涓婄骇id
 	}
 
diff --git a/request/audio.go b/request/audio.go
index f54cd2b..e146e7e 100644
--- a/request/audio.go
+++ b/request/audio.go
@@ -12,7 +12,7 @@
 }
 
 type ProcessAudio struct {
-	ID uint `json:"id" binding:"required"`
+	ID uint `json:"id" form:"id" binding:"required"`
 }
 
 type BatchProcessAudio struct {
diff --git a/response/audio.go b/response/audio.go
index dc61f7a..23f45c9 100644
--- a/response/audio.go
+++ b/response/audio.go
@@ -3,5 +3,5 @@
 import "speechAnalysis/constvar"
 
 type FollowResp struct {
-	FollowStatus constvar.BoolType `json:"followStatus"`
+	FollowStatus constvar.BoolType `json:"followStatus"` //1 宸插叧娉� 2鏈叧娉�
 }
diff --git a/router/router.go b/router/router.go
index 1a4ad18..a60c840 100644
--- a/router/router.go
+++ b/router/router.go
@@ -27,6 +27,7 @@
 	{
 		audioAPi.POST("upload", audioCtl.Upload)              // 涓婁紶闊抽
 		audioAPi.GET("list", audioCtl.List)                   // 闊抽妫�绱�
+		audioAPi.GET("info", audioCtl.AudioInfo)              // 闊抽璇︽儏
 		audioAPi.GET("trainInfoList", audioCtl.TrainInfoList) // 鐏溅淇℃伅鍒楄〃
 		audioAPi.POST("process", audioCtl.Process)            // 闊抽澶勭悊
 		audioAPi.POST("batchProcess", audioCtl.BatchProcess)  // 闊抽鎵归噺澶勭悊

--
Gitblit v1.8.0